- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
12-05-2016 01:19 AM
Hello,
Google has launched a new tool (beta) named Google Optimize (https://www.google.com/analytics/optimize/) and enables A/B testing on your website.
Google FAQ page: https://support.google.com/360suite/optimize/answer/6262084
To set it up, using Tealium you need to follow those steps:
1. Open your Google Analytics Tag in Tealium, click edit, Advanced and Edit templates
2. Add the following part of text to line 303:
//Set Google Optimize
u.o("require", "GTM-T324QFW");
Screenshot image: http://tinypic.com/r/2i067lt/9
12-05-2016 03:44 PM
Thank you for posting this tutorial, @consochris. Much appreciated.
07-17-2017 04:49 AM - last edited on 07-17-2017 09:38 AM by kathleen_jo
Hi @consochris!
How did you implement the page hiding snippet in Tealium IQ?
As described here, it looks like we need to move enitre GA tag to the webpage, but I want to keep it in Tealium IQ.
https://support.google.com/360suite/optimize/answer/6262084#step-2
Regards,
Ketil
07-28-2017 02:43 AM - edited 07-28-2017 02:47 AM
12-28-2017 05:13 AM - edited 01-03-2018 02:29 AM
Dear All,
I would say a better still way is to include the whole modified GA snippet in Tealium sync tag (accessible via 'Manage Templates'). This way it loads quicker, which is so important to speed up loading of variations and reduce flickering.
Still, the primary issue is the hiding snippet. I have added the following to the utag.sync template:
//create data layer var dataLayer = dataLayer || []; //create style for hiding element var css = '.async-hide { opacity: 0 !important} ', head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); style.type = 'text/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); }; //hiding snippet (function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date; h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')}; (a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c; })(window,document.documentElement,'async-hide','dataLayer',4000, {'GTM-MF5BFM5':true}); head.appendChild(style);
It seems to work, but if anyone has a better suggestion or can improve the hiding snippet, please let me know.
Thanks,
Florian
02-09-2018 01:39 AM
Hi,
I tried the approaches listed here. But in my case, calling
u.all("require", 'GTM-XXXXXXX'); worked rather than
u.o("require", 'GTM-XXXXXXX');
And the experiment details were getting captured successfully in Google Optimize chrome plugin when doing a preview.
02-09-2018 11:34 AM - edited 02-09-2018 11:35 AM
u.all worked @neetuch, huh? Great feedback! Thank you for letting us know. @kjuvvala have you tried u.all instead? Give it a go and let us know how it goes!
@florian_perl Thank you for the hiding snippet code. Has anybody else used it and can give Florian feedback? I'm looking at you @consochris! LOL
06-13-2018 03:20 AM - edited 06-13-2018 03:23 AM
Hi @all I'm looking for an approach to load the google optimize snippet only in specific profiles. We run a library which includes the GA Universal Tag. A duplicated Tag in the specific profile is no option. So I tried to add following code snippet to the tag template:
if(ut.profile == '{profileName}'){ //Set Google Optimize u.all("require", "GTM-XXXXXX"); }
If we run this, the GA Tag is blocked and no request were sending to Google Analytics. Any Ideas?
Kind Regards
Patrick
08-01-2019 02:11 AM - edited 08-01-2019 02:14 AM
08-01-2019 02:46 AM
@Sumanth, have you tried the sync tag (a few comments above)? It is not the most elegant way, but it is hassle-free and - importantly! - gets Optimize to load a bit earlier.
08-01-2019 03:42 AM - edited 08-01-2019 03:43 AM
@florian_perl Thanks for getting back.
Yes, I have added the optimize script in utag sync.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXX-X', { 'optimize_id': 'GTM-XXXXXX'});
</script>
When I run AB test on the page. It is unable to find the Optimize ID as the script is in the sync file and not rendered in the head tag. As far as I can understand the Optimize code should be in the head tag.
08-01-2019 03:46 AM
If utag.sync.js is in the <head> section, then you should be all good.
Copyright All Rights Reserved © 2008-2023