2.5K 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

Running experiments

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I've followed the guide to insert experiment code to the header tag. Experiment code shows found and working in the original page, and Universal Analytics code is shown in both original and variant page as working as well. But, all links on the variant page lead right back to the variant page itself, not to location desired. 

 

Everything else seems to be good, just the links if off. What am I doing wrong?

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Terrence N
June 2016

Re: Running experiments

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
Hi Theo,

I finally figured it out. In case anyone else runs into the same problem, they should add the following code to Wordpress header.php file:

<?php if (is_page($page_id)) :
//Add Google Analytics Content Experiment
?>

Paste content experiment code here

<?php endif; ?>


The problem is that if you have a Wordpress site (which I should've mentioned) your header.php file puts the code into every page, not just the original page, without the "if" conditional.

View solution in original post

Re: Running experiments

Rising Star
# 2
Rising Star
Hi Terrence,

GA only dynamically offers the variant and the original and provides the analysis on the desired goal or transaction that you selected.

If there is a problem with the underlying variant, you'll have to have that page corrected by your developers.

Hope that helps.

Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Running experiments

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
So, while the experiment isn't running all links work fine. Only when the
experiment is running are there problems. I don't have a developer, only
me. Has anyone had this problem before?

Re: Running experiments

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
Hi Theo,

How do I know if there is a problem with my page? If I go directly to the url (including the experiment URL), everything works. If I "stumble" upon the page (letting GA choose which variant I will go to), none of the links work. So it seems like the page is fine, only when GA chooses the page naturally is there a problem.

Re: Running experiments

Rising Star
# 5
Rising Star
Hey Terrence,

I've never had this problem before and it seems very counter-intuitive. All GA does is - via the control script on your A page -- point a person to the B page. There is no different GA coding on that page (the B page) then on any other page on your site (with the exception of the control script on your A page) so It seems highly unlikely that it's related to GA or you would expect to see it everywhere.

-Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn
Marked as Best Answer.
Solution
Accepted by topic author Terrence N
June 2016

Re: Running experiments

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
Hi Theo,

I finally figured it out. In case anyone else runs into the same problem, they should add the following code to Wordpress header.php file:

<?php if (is_page($page_id)) :
//Add Google Analytics Content Experiment
?>

Paste content experiment code here

<?php endif; ?>


The problem is that if you have a Wordpress site (which I should've mentioned) your header.php file puts the code into every page, not just the original page, without the "if" conditional.

Re: Running experiments

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Hello Terrence,

Im using a wordpress website as well but the if code isnt working for me. Trying to set up analytic experiments and been using this if code but its not working correctly for me. I set 75% of of traffic to experiment but it's sending 75% of our total website traffic to the variant. Not 75% of the original page's traffic. Any ideas where I could be going wrong?

Here is the code Im using. I've removed the k code.
<?php if (is_page(310)) :
//Add Google Analytics Content Experiment
?>

<!-- Google Analytics Content Experiment code -->
&lt;script&gt;function utmx_section(){}function utmx(){}(function(){var
k='########-#',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>')})();
&lt;/script&gt;&lt;script&gt;utmx('url','A/B');&lt;/script&gt;
<!-- End of Google Analytics Content Experiment code -->

<?php endif; ?>