Deprecated: Assigning the return value of new by reference is deprecated in /home/ophir/prusak.com/wp-settings.php on line 512

Deprecated: Assigning the return value of new by reference is deprecated in /home/ophir/prusak.com/wp-settings.php on line 527

Deprecated: Assigning the return value of new by reference is deprecated in /home/ophir/prusak.com/wp-settings.php on line 534

Deprecated: Assigning the return value of new by reference is deprecated in /home/ophir/prusak.com/wp-settings.php on line 570

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1199

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1244

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1391

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/ophir/prusak.com/wp-includes/classes.php on line 1442

Strict Standards: Redefining already defined constructor for class wpdb in /home/ophir/prusak.com/wp-includes/wp-db.php on line 308

Deprecated: Assigning the return value of new by reference is deprecated in /home/ophir/prusak.com/wp-includes/cache.php on line 103

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/ophir/prusak.com/wp-includes/cache.php on line 431

Deprecated: Assigning the return value of new by reference is deprecated in /home/ophir/prusak.com/wp-includes/query.php on line 61

Deprecated: Assigning the return value of new by reference is deprecated in /home/ophir/prusak.com/wp-includes/theme.php on line 1109

Strict Standards: Declaration of Walker_Comment::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/ophir/prusak.com/wp-includes/comment-template.php on line 1266

Strict Standards: Declaration of Walker_Comment::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/ophir/prusak.com/wp-includes/comment-template.php on line 1266

Strict Standards: Declaration of Walker_Comment::start_el() should be compatible with Walker::start_el(&$output) in /home/ophir/prusak.com/wp-includes/comment-template.php on line 1266

Strict Standards: Declaration of Walker_Comment::end_el() should be compatible with Walker::end_el(&$output) in /home/ophir/prusak.com/wp-includes/comment-template.php on line 1266

Strict Standards: Redefining already defined constructor for class WP_Dependencies in /home/ophir/prusak.com/wp-includes/class.wp-dependencies.php on line 31

Strict Standards: Redefining already defined constructor for class WP_Http in /home/ophir/prusak.com/wp-includes/http.php on line 61

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/ophir/prusak.com/wp-settings.php:512) in /home/ophir/prusak.com/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 92

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/ophir/prusak.com/wp-settings.php:512) in /home/ophir/prusak.com/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 92

Strict Standards: Redefining already defined constructor for class ftp_base in /home/ophir/prusak.com/wp-content/plugins/wordpress-automatic-upgrade/lib/ftp_class.php on line 56

Strict Standards: Redefining already defined constructor for class ftp in /home/ophir/prusak.com/wp-content/plugins/wordpress-automatic-upgrade/lib/ftp_class_sockets.php on line 8
Google Website Optimizer and Analytics Bugfix

Prusak.com

Online Since 1996

Google Website Optimizer and Analytics Bugfix

Posted by ophir on June 13th, 2007

A few weeks ago Shawn Purtell from ROI Revolution wrote an excellent article on combining GWO with GA. If you haven’t read his article - please do so now. This posting describes a bug fix for his code, but you really should first read his article to fully understand how to use it.

I just found a bug in his code and am providing a fix for it. Under some circumstances, his code will provide the wrong combination number for the combination that is being displayed. Different combinations can be given the same combination number.

Please note: If you only have a single section on your page, Shawn’s code works fine as is.

To properly use the new getcombo function, you need to pass in a parameter. The parameter is a string with the number of variations in each section, seperated by dashes.

For example, if the first section has three variations, the second section has four variations and the third section has two variations you’d call the function as such:
getcombo(’3-4-2‘);

If the first section has five variations and the second section has two variations, you’d call the function as such:
getcombo(’5-2‘);

The javascript code with the bug fix can be -> downloaded here. <-

In order to allow a simple replacement of Shawn’s version, getcombo does not require a parameter. If you do not pass in any parameter, the function uses the same calculations as Shawn’s version, which did not require a parameter.

In order to get a better idea of how the bug can effect the combination number you get, I created a page that shows the different results you get from the old and the new versions of getcombo(). It lists all of the possible combinations for an experiment with two sections and between two and four variations for each section.

You can see the test page here.

Please note: The page is actually running each version of getcombo() to product the results. You can view the page source to see the javascript I wrote to test the two versions. 

 Please let me know if you have any questions.

- Ophir

3 Responses to “Google Website Optimizer and Analytics Bugfix”

  1. Eli Roth Says:

    I would like to know how to use the getcombo function when i have a few GWO tests running at once?

  2. J Says:

    Eli,
    the getcombo function will return the combo information for the first experiment in the cookie. If you are running multiple GWO tests that were hit upon, the utmx cookie will contain this information and grabbing the first may return the combo information for the wrong experiment.

    Example of google utmx cookie with 2 tests. The experiment id has been hidden and replaced by “xxxxxtest1″ and “xxxxxtest2″ in the below example. “test1″ was an experiment where I visited Variation 1 and “test2″ was an experiment where I visited Variation 2:
    __utmx
    53881888.0000103110xxxxxtest1:2:1.0000097245xxxxxtest2:1:2

    In order to grab the correct combo, you need to pass into the function the experiment id that you are looking for combo information for. You also need to split the cookie on “.” to split up the different experiments - then you can split the data on “:”. I am not very good with javascript but the below function works for me. NOTE: It will NOT work if your multivariate experiment also has multiple sections having variations (it will only work if you have one section with multiple variations). For the multi-section/multi-variation to work, the code that fixed the bug in the getcombo function would have to be adapted to this function and you’d have to pass into this function both an experiment id and the number of variations you have in each section. I hope this helps someone but please use this at your own risk and please excuse my lack of Javascript knowledge - hopefully a real javascript programmer can pull this all together & post a better function that works for all scenarios.

    function multiexperiment_combo(experimentid)
    {
    if (document.cookie.indexOf(”__utmx=”) != -1)
    {
    var utmx_cookie_value = readCookie(’__utmx’);
    var cookie_data_array = utmx_cookie_value.split(’.');
    for(i=0; i0)
    {
    return combination_id;
    }else
    return 0;
    }
    }
    }

    }
    }

    To use this function, follow all installation instructions for using the getcombo function. Then modify gwo_analytics_integration.js and add this new function. On your Test page where you would normally call the getcombo function - just call multiexperiment_combo(”xxxxxtest1″); function instead. Replace “xxxxxtest1″ with your actual experiment id given by google when you set up your experiment. If you don’t know your experiment id, look at your conversion page code snippet given by google for the line that looks like this:

    urchinTracker(”/xxxxxtest1/goal”);

  3. Yesak Says:

    Hello,
    thank you for this script, it seems to be very cool :)
    Does it work with the new GATC : GA.JS ?
    Best Regards,
    Y

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>