Optimize
2.1K members online now
2.1K members online now
Everything you need to know about setting up Optimize including creating your account and container, linking to Google Analytics and how to tag your site.
Guide Me
star_border
Reply

Tagging your site

Community Manager
# 1
Community Manager

You must install the Optimize snippet on the pages that you wish to experiment on. Here's how to do it. 

 

1. If you're using Google Tag Manager you'll need the following:

 

  1. Analytics property ID – from Google Analytics.
  2. Optimize container ID – from the Container setup panel.

Once you have both, follow the installation guidance in the Tag Manager help center to deploy Optimize via Tag Manager.

 

If you're using another Tag Management System (TMS) please follow their instructions. 

 

2. If you're using Google Analytics get your Optimize snippet from the Container information panel on the experiments page. Click on the blue container ID (e.g. GTM-XXXXXX) next to Optimize snippet and follow the on-screen instructions.

 

Optimize is a single line of code that looks like this:

ga('require', 'GTM-XXXXXX');

When added to your Analytics tracking code the combined Analytics and Optimize snippet looks like this:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-XXXXXXX-X', 'auto');
  ga('require', 'GTM-XXXXXX');
  ga('send', 'pageview');

</script>

Note: Replace GTM-XXXXXXX with your Optimize container ID, and UA-XXXXXXX-X with your Analytics tracking ID.

 

Read more about how to Add Optimize to your website on the help center. 

 

1 Expert replyverified_user

Tagging your site

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

Hi Jason, I'm on the beta for the free version of Optimize and we're having a lot of grief getting the page hiding snippet to load and stop the 'flicker'.

 

We're using GTM to install the Optimize code and the page hiding snippet is hard coded. Despite us installing the page hiding snippet directly after the opening <head> tag, it doesn't work properly and the flicker is still there. 

 

Can you help us figure where we're going wrong?

Tagging your site

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Jason,

 

Though we are not using GTM (shopify GTM is a bit nasty) - we have implemented both snippets in the theme, but OPTIMIZE will not confirm that we have implemented the snippets. Could you please have a look at www.jasonl.com.au and let me know your dianosis?

 

 

Tagging your site

Community Manager
# 4
Community Manager

Hi @Boris G,

 

I took a look at your tagging and two things jump out at me: 

 

1. Put the page hiding snippet before the Analytics-Optimize snippet

2. Move both as high up in the HEAD as possible. 

 

We recommend following the tagging best practices in the Deploy Optimize help center article. Generally, the order of the tags should be:

 

1. Initialization of any variables needed for targeting (data layer, Javascript, cookies, etc).
2. Any JavaScript (e.g. jQuery) that you wish to use in Optimize experiments. We recommend you keep these to a minimum.
3. Page-hiding snippet.
4. Analytics-Optimize snippet.
5. Other JavaScript, trackers, analytics and ad tags.

 

Hope that helps, 

Jason

 

 

 

Tagging your site

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thanks @Jason O - I will try this and let you know.

Just FYI - since implementing the snippet this way, I noticed that our analytics tracking messed up - our bounce rate is <5% and our pages/session has doubled - really weird side affect.

 

Will let you know how it goes.

Tagging your site

[ Edited ]
M B
Visitor ✭ ✭ ✭
# 6
M B
Visitor ✭ ✭ ✭

How does it goes? I am wondering if the page hiding snippet can be placed with GTM as well. Is it?

Tagging your site

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Hi Jason,

 

I am planning to implement Optimize using Analytics-Optimize snippet (as it is the recommended method by Google specified in https://support.google.com/360suite/optimize/answer/7359264 link ). But my website tracking is setup using Google Tag Manager. If I add Analytics-Optimize snippet to my webpage, will it have any impact like new users getting created by Google Analytics due to two trackers being created  

Tagging your site

Community Manager
# 8
Community Manager

If you use GTM, our recommended method is to follow the instructions in this help center article: https://support.google.com/optimize/answer/7359264

 

When you deploy Analytics tags through Tag Manager, it is still recommended that you install the Analytics tracking code with the Optimize plugin directly on the page (as opposed to deploying Optimize through a tag in GTM). You will modify the code so that it doesn't send any Analytics hits. You do not have to modify your Analytics tags in Tag Manager.

 

Hope that helps,

Jason

Tagging your site

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Hi @Boris G and @Jason O, nice to e-meet you guys. :-)

Precisely, I'm doing a quick research over the potential impact that implementing the page-hidden snippet could have over the pages' load time, hence over the bounce rates. In other words, we wonder if this snippet would make the pages in the experiment take more time to load, hence make more visitors to leave it before it loads, hence increment bounce rates.

Can you please help me understanding this better?

Thank you in advance! :-)