Put Google Analytics Experiment Code In Header of Just Home Page

Community Forums Forums Design Tips and Tricks Put Google Analytics Experiment Code In Header of Just Home Page

This topic is: not resolved

This topic contains 2 replies, has 3 voices, and was last updated by  mborger 2 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #5644


    I am trying to use Google Analytic s to split test my Home Page against a test page but if I put the code in the Genesis wp-head box then the code is in the header of every page.

    How do I put the code in the header of just the Home page so that it is not in the header of all of the other pages?






    Try using the Genesis Simple Hooks plugin and the wp_head or genesis_meta hook. Then make the code conditional for is_home()




    Hi Nick. I’m not sure if this the right place, but I have a similar concern. I’m trying to get Google Experiments to validate on a Premise page. When I try to validate on the GCE page, it says “No experiment code found” with a bubble saying the validation code needs to be in the first 256kb (not sure if that’s the issue).

    I do have the checkbox on the landing page checked to enable GCE and have the proper code in the Original page.

    I thought I’d try another way and put the GCE experiment code in the page header. Using GSH, I put this code in the genesis_meta Hook where 5804 if the landing page ID (the GCE script is just copied from the Experiment page):

    <!– Google Analytics Content Experiment code –>
    if(is_page(5804)) { ?>
    <script>function utmx_section(){}function utmx(){}(function(){var
    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':
    ‘&utmx=’+(x?x:”)+’&utmxx=’+(xx?xx:”)+’&utmxtime=’+new Date().
    ‘” type=”text/javascript” charset=”utf-8″><\/sc’+’ript>’)})();
    <?php }
    <!– End of Google Analytics Content Experiment code –>

    GCE still won’t validate saying it can’t find the code. What else can I try?



Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.