WordPress.org

Ready to get started?Download WordPress

Forums

Google Content Experiments
[resolved] Code will not Validate (6 posts)

  1. gregmurch
    Member
    Posted 1 year ago #

    After setting everything up as per this guide:
    http://www.becomeablogger.com/14447/how-to-run-split-tests-in-google-analytics-with-content-experiments/

    I have added the code.
    Experiment Code Validation
    Original:
    No experiment code found.
    Variation 1:
    Google Analytics code found

    I am using Optimisepress theme,
    Wordfence Plugin,
    Yoast SEO plugin,
    Yoast Google Analytics Plugin.

    When I manually edit the header.php file to add in the code i get the errors:
    Experiment Code ValidationRevalidate
    Original:
    Experiment code found after the Google Analytics tracking code:line:34, column:57,line:313, column:1.
    Variation 1:
    Experiment code found after the Google Analytics tracking code:line:33, column:57,line:345, column:1.
    Note: If you're sure that the pages are properly set up, you can still start the experiment.

    http://wordpress.org/extend/plugins/google-content-experiments/

  2. glennm
    Member
    Plugin Author

    Posted 1 year ago #

    Could you please tell me what you exactly edited?

    You need to insert <?php do_action( 'wpe_gce_head' ); ?> right after the opening <head> tag. I believe OptimizePress has more than one header file, so you might need to edit multiple files.

  3. gregmurch
    Member
    Posted 1 year ago #

    I edited the OptimizePress: Main Index Template (admin/index.php)
    it now reads <head>
    <!-- Google Analytics Content Experiment code -->
    <script>function utmx_section(){}function utmx(){}(function(){var
    k='72203813-0',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><script>utmx('url','A/B');</script>
    <!-- End of Google Analytics Content Experiment code -->

    </head>

  4. glennm
    Member
    Plugin Author

    Posted 1 year ago #

    That is the wrong file.
    You need to edit header files in the root of OptimizePress directory.
    I don't know which files you have exactly, but you might need to edit for example:

    wp-content/themes/OptimizePress/header.php
    wp-content/themes/OptimizePress/header-myheader.php
    wp-content/themes/OptimizePress/header-blogheader.php

  5. gregmurch
    Member
    Posted 1 year ago #

    I have tried to add the code to Header.php on the 2nd line down and it appears to be working.

    Thank you for your help.
    Optimisepress need to update the videos

  6. glennm
    Member
    Plugin Author

    Posted 1 year ago #

    Glad I could help.

    If you found this plugin useful, there are several things you can do:

    - Rate the plugin
    - Vote that the plugin works (with the WordPress version you're currently using).
    - Write a review for the plugin
    - A combination of the steps above

    I would be most grateful for your contribution!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic