Mobile app version of vmapp.org
Login or Join
Fox8124981

: How long does it take for Google Experiments to record sessions? UPDATE: It took 5 hours I have set up a Google Experiment using Google Tag Manager code to send a hit with the ID and Variation.

@Fox8124981

Posted in: #Untagged

UPDATE: It took 5 hours

I have set up a Google Experiment using Google Tag Manager code to send a hit with the ID and Variation. I'm just wondering how long it takes the Google Experiment to record session data as I'm anxious that its not working?

Thanks

This is my code:



<script type="text/javascript">

var expID = 'XXXXXXXXXXXX'; //Set up an experiment and pull through the ID;
var cusDom = [1, 'example.com']; //If Needed set BOOLEAN to 1, if not 0;
var trackingType = "GAClassic"; //Select Only One;
var variations = [
{
'fn' : function () {
;
}
},

{
'fn' : function () {
document.getElementById("ContactUs").innerHTML = "Register Interest";
}
}
];

var tempBoolean = false;

var gaExScript = document.createElement('script');
gaExScript.src="https://www.google-analytics.com/cx/api.js?experiment="+expID;
document.head.appendChild(gaExScript);

function bleep() {
if(tempBoolean == true){
var variNum = 999;

if(cusDom[0] === true){cxApi.setDomainName(cusDom[1]);}

var variationNumber = Math.floor(Math.random() * variations.length);
var previousVariation = cxApi.getChosenVariation(expID);

if (previousVariation != -1){
cxApi.setChosenVariation(previousVariation);
window.onload = variations[previousVariation].fn;
variNum = previousVariation;
}else{
cxApi.setChosenVariation(variationNumber);
window.onload = variations[variationNumber].fn;
variNum = variationNumber;
}
var analyticsScript = document.createElement('script');
if(trackingType == "GAClassic"){analyticsScript.innerHTML = "_gaq.push(['_trackEvent', 'CRO Experiment', 'Experiment ID: " + expID + "', 'Variation ID: " + variNum + "']);";}
else if(trackingType == "GAUniversal"){analyticsScript.innerHTML = "ga('send', 'event', 'CRO Experiment', 'Experiment ID: " + expID + "', 'Variation ID: " + variNum + "', {nonInteraction: true});";}
else if(trackingType == "GTM"){analyticsScript.innerHTML = "dataLayer.push({'event': 'eventGA', 'eventCategory': 'CRO Experiment', 'eventAction': 'Experiment ID: " + expID + "', 'eventLabel': 'Variation ID: " + variNum + "', 'eventValue': '0', 'eventNonInteraction': 'false'});";}
document.head.appendChild(analyticsScript);
}
};

gaExScript.onload = function(){
tempBoolean = true;
bleep();
}

</script>




It appears that the events are firing correctly. However, the sessions are not showing on my experiment.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

1 Comments

Sorted by latest first Latest Oldest Best

 

@Welton855

In addition to my update above, my experiment is now tracking correctly. The data took around 5 hours to come through so if you're setting one up, I recommend being patient!

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme