Analytics
3.9K members online now
3.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google A/B Experiment code not found on original page.

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I am trying to add the experiment code to the original page using jade templates, but google is not picking up the code. I broke the script up as shown below and inserted it right after the opening head tag: 

 

script(type="text/javascript").
function utmx_section(){}function utmx(){}(function(){var k='12306304-3',d=document,l=d.location,c=d.cookie; if(l.search.indexOf('utm_expid='+k)>0)return; function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c. indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c. length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write( '<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl': '://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+ '&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date(). valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+ '" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
script(type="text/javascript").
utmx('url','A/B');

 

Are there any other reasons google might not be picking up the code? And how do I know if it's okay to continue anyway?

Google A/B Experiment code not found on original page.

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

Hi there,

 

Did you ever work out how to get it to work in jade?

 

Thanks

Google A/B Experiment code not found on original page.

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hey, this is what ended up working for me: 

 

script.
    function utmx_section(){}function utmx(){}(function(){var k='12306304-9',d=document,l=d.location,c=d.cookie; if(l.search.indexOf('utm_expid='+k)>0)return; function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c. indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c. length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write( '<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl': '://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+ '&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date(). valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+ '" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();


script.
    utmx('url','A/B');

Google A/B Experiment code not found on original page.

Follower ✭ ✭ ☆
# 4
Follower ✭ ✭ ☆

Hi Halsey

 

Are you getting errors such as "No Google Analytics tracking code found."?
If so, do not worry about starting the test and think that there is no problem.

 

Thanks