Last updated on February 20, 2016
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.