A/B Testing Made Simpler with GTM Change | DMA

Filter By

Show All
X

Connect to

X

A/B Testing Made Simpler with GTM Change

T-58107dbaa38a7-goog-an_58107dbaa37af-5.png

Google Optimize through GTM

Yes you heard right, you can now add an A/B testing solution to your website without involving your development team. This new Google Optimize tag will allow you to do just that through GTM. When creating a new tag, choose Google Optimize as the tag type. Then, just 3 simple configurations to get this tag ready:

  1. Add your GA property ID
  2. Add your Optimize container ID
  3. Add a firing trigger

When creating this tag it is important to note that because the Optimize container works together with Google Analytics, the tracker settings of your Optimize tags (found under More settings) must be consistent with those of your Google Analytics tags.

For example, if in your GA tags you have the anonymizeIp field set to true, then this must also be configured and consistent in the Optimize tag. This is also the case if you have renamed your global function name, which should also be configured in the Optimize tag.

Optimize’s page hiding snippet

Optimize modifies elements in the DOM to be able to display different variants of the page to your users. These changes can sometimes happen while elements are visible on the page, which causes flickering.

The page hiding snippet temporarily hides the page to the user while the Optimize container loads, mitigating the risk of flicker. This extra bit of recommended, not mandatory, code should be added to the site’s <head> tag whilst deploying Google Optimize.

If you deploy Optimize through GTM and decide to use the page hiding snippet, you will have to ensure that the highlighted ID below references your GTM container ID and not the Optimize container ID.

GTM Snippet Installation

Previous guidelines recommended the entire GTM container snippet be placed as high up in the <body> tag as possible. Now, however, the snippet has been split into 2 parts – the script and noscript part. Each of these 2 parts are to be placed in different locations of the DOM. The script portion of the snippet should be placed as high in the <head> as possible, and the noscript portion should be placed immediately after the opening <body> tag.

Along with the placement, the other alteration you will see in the GTM snippet is the change from a protocol-relative URL to a default https protocol to load the containers. As you may have guessed, this is a far more secure default, which will protect your container from snooping and malicious parties. If however you wish to load GTM in a protocol-relative approach, you can do so by removing the protocol from the URL in the snippet.

With the protocol-relative URL, on http pages the container will load as http, and on secure pages, the container will load as https.

I already have GTM installed in the previous method, now what?

Don’t fret, this method will still work, so in the short term there is no need to change existing configurations unless you want slightly more accurate data. If however, you are using Google Optimize and want to use the template tag (outlined above) be sure to change the snippet location to the new configurations or use the page hiding snippet.

One thing to note, if you do decide to move the container snippet, a strong review of any page load dataLayer pushes would need to be completed to ensure that the push order remains consistent and there are no declarations that will overwrite the gtm.js push as they may sit below the main container.

To read this blog written by Shahina Meru on the Periscopix website, please click here.

Hear more from the DMA

Please login to comment.

Comments