Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Google Experiment within Google Tag Manager

I have been trying to get this to work for sometime and there seems to be very little information on how this works.

First, I would like to say that I tried the below method to get it working, so please read this before posting a solution.

What I tried: I added the google analytics experiment code in a custom HTML block and had it fire only of the original page as stated by google. This doesn't work and seems to create a loop for users. A white page appears when users get to the experiment pages.

Does anyone know how to get this to work? Much appreciated

like image 666
KingOptimizer Avatar asked May 10 '14 00:05

KingOptimizer


People also ask

Can you use Google Analytics and Tag Manager at the same time?

In this case, GTM allows you to easily set up a Click Trigger and a Google Analytics Tag to see what and where resources are being downloaded without needing to add any additional code to your site. Furthermore, you can use Google Tag Manager triggers to dictate when this data should be sent to Google Analytics.


2 Answers

The Javascript versions of Google Content Experiments are not actually supported in GTM at the moment (they have do do either redirects or change the site on the fly and since it's hard to say in advance at which point during page load the tags fire, and it which order, this does not work very well - in the very best case the original page would load completely before the visitor is redirected to a variation).

The features page for GTM lists A/b testing tags as "coming soon" but does so since at least a year ago, so I wouldn't hold my breath.

However you can do variations serverside (you'd have to implement your own logic to display the proper variation to each users) and pass and experiment id and the variation number to GA via GTM. I do not think there is another (reliable) way to do this, at least not yet. If you need to do it with javascript you should add the experiment scripts to the page code instead of deploying them via tag managemement.

Having said that, there are descriptions for hacking around the GTM limitations using the Experiments Javascript API and some jQuery (here is one). When Google says that something is "not supported" it might just mean they didn't want to test all possible edge cases and err on the safe side. So you if you absolutely have to use GTM for Content Experiments you would have to test if something like this would work for you.

like image 197
Eike Pierstorff Avatar answered Oct 22 '22 04:10

Eike Pierstorff


I hope that I understand your problem well. If yes, you can use Google Optimize instead of Google Experiment. The Google Optimize works with Google Tag Manager by default.

like image 36
William Avatar answered Oct 22 '22 05:10

William