Optimizely Universal Analytics Integration using GTM template tags: Case of redirects
Technical Support Representative
This is great! Quick Q for @Amara: Does this work in tandem with the existing recommended solution for sending Optimizely IDs to GA (via GTM macro and PV tag...)? Or is it a total replacement? Just want to make sure I have both redirect & non-redirect experiments covered, and not overwriting each other.
Also, do you need to modify this JS with your own dimension slot # or no?
On #2 -- I didn't have to modify the JS; just specified the custom dimension in Google Tag Manager.
**One word of caution, I am still seeing significant variances from time-to-time on the metrics reported by GA vs. the Optimizely reports... Support said it might be because I'm firing off a custom event tag rather than piggybacking on my core Universal Analytics page view tag... I'd recommend you do the latter.
This is my setup:
1) The core Optimizely JS snippet is hard-coded on my site in <head> section (as it's recommended to not deploy through GTM)
Then to enable this integration I did the following:
2) Add 1 custom HTML tag which includes the JS listed on JSFiddle in that community post I listed in this ticket; the trigger is "All Pages" (with a few exceptions where I don't need it)
3) Add 1 Universal Analytics custom event tag. Which fires a custom event (rather than a PV) triggered upon the 'optimizely' data layer event from the JS in my first tag... This is where the custom dimension is set.
3) Setup a custom report in GA grabbing the custom dimension and metrics like sessions, conversions, etc.
This is a fantastically thorough response, @mattkam, thanks for that and the speed of the reply!!
Just to confirm, you'd recommend NOT going with the custom event tag fire that you have as your current set up? Wondering out of curiosity why you'd go that route if it causes reporting discrepancies.
It sounds like as long as I follow the original directions (include the JSfiddle snippet as a variable, pass that as the value for the correct dimension slot index within the UA tag I already have in place), there shouldn't be anything to worry about.
Let me know if the above is (in)correct!
To be clear, what were your reasons for doing steps 2) and 3) over placing the JSFiddle into a variable like Optimizely originally suggested here - https://help.optimizely.com/Integrate_Other_Platforms/Implementing_Optimizely_with_Google_Tag_Manage...?
Could you provide more info on firing the UA custom event tag by the data layer event? Sounds like a great solution for integration with GA only working on pages that you are testing and testing.
Thanks again for sharing!