In my previous post I’ve talked about how to manage to use the native Optimizely tracking when using Google Tag Manager . Now we’re going further and we’ll learn how to track the experiment that are based on redirects in the best way possible.
In case we’re lucky because optimizely will write a cookie with the original referral info, se we can read it later! :). That way we could override the referrer field within our pageview tag to keep the real attribution for those visits.
We’ll need a 1st Party Cookie variable to read this cookie value:
Then we’ll need to do use this variable in our pageview tag this way:
There we go, now even if something lands on a redirect experiment, the original referral will be tracked in Google Analytics.
Latest posts by David Vallejo (see all)
- Integrating Google Optimize with Google Tag Manager - January 9, 2017
- SEO meets GA: Tracking search bots visits within measurement protocol - November 16, 2016
- Cross-Domain tracking with clean urls - November 1, 2016