Highlighted

How to send GA Campaign data to campaign cookie when redirect url prevents this...?

Rookie Contributor
When you go to http://www.standaard.be/plus/avond, and youâ re not logged in, you will be directed to http://www.standaard.be/plus/login-avond?goto=http%3A%2F%2Fwww.standaard.be%3A80%2Fplus%2Favond This is not an issue as such but it become an issue when related to campaign tracking. So if we take the same URL but which includes GA campaign parameters, the same redirect happens, but the campaign info is not being send to the GA campaign cookie (_utmz), because of this redirect. http://www.standaard.be/plus/avond?utm_source=standaard&utm_medium=bannerfoot&utm_campaign=behaviora... becomes http://www.standaard.be/plus/login-avond?goto=http%3A%2F%2Fwww.standaard.be%3A80%2Fplus%2Favond%3Fut... So what we would like to solve via Tealium, and send the campaign info, one way or another, to the cookie. As you see from teh example above, the campaign parameters and values are still included in the URL. So my idea was to get the GA campaign parameters based on the info from the URL (utm_source=standaard&utm_medium=bannerfoot&utm_campaign=behavioraldsavondpromo) attached to the redirected URL (applying a load rule in order to define when this should happen) , so this will become http://www.standaard.be/plus/login-avond?goto=http%3A%2F%2Fwww.standaard.be%3A80%2Fplus%2Favond%3Fut... But there might be another more simple solution?
3 REPLIES 3
Highlighted

How to send GA Campaign data to campaign cookie when redirect url prevents this...?

Employee Emeritus
High-level Answer: For Legacy Google Analytics (ga.js): Check out this page on Google's Developer's Network. https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking?cs... You can set these values manually by adding values into the _gaq array that Google creates on page load. _gaq.push(['_setCampMediumKey', ]); _gaq.push(['_setCampNameKey', ]); _gaq.push(['_setCampContentKey', ]); _gaq.push(['_setCampSourceKey', ]); _gaq.push(['_setCampTermKey', ]); For Universal Analytics (analytics.js): You can simply map variables using the Campaign tab in the Mapping Toolbox within the GUA tag. Your specific use case: The difficult part will be parsing the URL to get these values. Because of the redirect, there is a good change the Google Analytics tag will not fire. As soon as the redirect begins the tracking calls will be cancelled. The best chance of tracking these will be on the following page where we get redirected to. So on the landing page you can use something like this: if(b['dom.url'].indexOf('goto=')>-1){ var str = decodeURIComponent(b['dom.url'].split('goto=')[1]); var qs = str.split('?')[1]; var qs_var = qs.split('&'); for(var i=0;i
Highlighted

How to send GA Campaign data to campaign cookie when redirect url prevents this...?

Employee Emeritus
Siegert, I updated my answer below. For legacy GA, you'll likely need to do some updates on your side to forward the query parameters to the new landing page. Legacy GA doesn't actually have very good support for this kind of thing. Google Universal Analytics handles this much easier. Here is a post explaining how to transition from legacy to GUA if you're interested. https://community.tealiumiq.com/posts/649921
Highlighted

How to send GA Campaign data to campaign cookie when redirect url prevents this...?

Rookie Contributor
Tx Jared. I'll take a more detailed look at this and get back to you.