2.8.3 SetCampaignNameKey JS Tracker

For one of our client sites a third party does the Google Advertising and they have their own google tracking.

Since I don’t want to miss out on the info and don’t want them to teach piwik tags, I am tryting to add the CampaignName when generating the site html in case I find a “gclid” parameter in the url.

This is how it looks in these cases at the bottom of the body


<script>
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
</script>
<script>
(function() {
var u=(('https:' == document.location.protocol) ? 'https' : 'http') + '://webstats.redacted.com/';
_paq.push(['setTrackerUrl', u+'js/']);
_paq.push(['setSiteId', '180']);
_paq.push(['setCampaignNameKey','google-adwords']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; 
g.type='text/javascript';g.defer=true; g.async=true; g.src=u+'js/'; s.parentNode.insertBefore(g,s);
})();
</script>

Whilst the pageview and everything else tracks beautifully, the Campaign name is nowhere to be found in the tracking request to Piwik generated by the javaScript.

What am I missing?