Set up Google Optimize and Tag Manager

Business Benefits

Serve personalized experiences that promote engagement and improve conversions.

Head to the Google Optimize site and click one of the Start for free buttons.

Click Get Started and complete the onboarding process.

  • Google recommends opting into improving Google products, benchmarking, and in-depth analysis.

Accept all terms and conditions, then click on My Container in the Experiments view and copy your account and container ID.

Click on Settings, then the Link to Analytics button, select the view you’d like to link, and click on Link.

Open Google Tag Manager and create a new tag, select Google Optimize from Choose tag type, and enter your Google Optimize and Google Analytics ID.

Choose your triggering options, save, then preview and debug.

If you’re going to experiment on your entire site, you can go with All Pages, but you can choose whatever you’d like.

Copy the full code below and add it to every page with Optimize, as early as possible but after any dataLayer declaration.

<!-- anti-flicker snippet (recommended)  -->
<style>.async-hide { opacity: 0 !important} </style>
<script>(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),'')};

Ensure that your Tag Manager container immediately follows the anti-flicker snippet. This creates a short delay in loading the page.

Last edited by @hesh_fekry 2023-11-14T16:01:29Z