The ROI Revolution Blog

Universal Conversion Code For Google Website Optimizer

October 13, 2009

it's universal

We've been using a piece of code for a while that makes it easier to set up multiple Google Website Optimizer experiments. These experiments could be one right after the other, or even several experiments running simultaneously. The only requirement is that you should have a single conversion point for all of your Google Website Optimizer experiments. You may be able to adapt this code to situations with multiple conversion points, but that's likely to get rather complicated. So why use this code? Oftentimes your conversion point is a page that you're not really wanting to edit a lot, or may even be able to edit a lot. Instead of having to update your conversion page every time you set up a new experiment, you just add this code to your conversion page once and forget about it. It will register a conversion for all current and future experiments, and will even accommodate visitors who may be part of more than one experiment. So here's the code:

A few things to keep in mind:

  • If you have your own functionally equivalent readCookie function, you can use that instead.
  • This code will probably work best if it comes after your Google Analytics Tracking Code.
  • If you have any kinds of modifications to your Google Analytics Tracking Code, you'll need to make those same modifications to your Google Website Optimizer code. See Shawn's post on this.
  • This code is meant to replace the Google Website Optimizer conversion script that's provided with your instructions.
That's it! I always appreciate suggestions for improving code I put up here. If you've found this code to be particularly useful, I'd like to hear that too.



Google Analytics for Online Advertisers
Here at ROI Revolution, we consider Google Analytics tracking essential for paid search, so it's included in our PPC Campaign Management service.

Comments

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Viktor said:

Hello!

I've a question which is not directly related with the post, but I think you can help me.

Im using analytics and website optimizer together, and I've already made a few experiments in the past, and everything went alright.

Yesterday I tried to make an experiment, but GWO javascripts messed up my analytics data. My direct traffic became very high, and after I removed the GWO javascripts, GA became normal again.

I made everything exactly like before, why is it that this time it messed up my analytics code? What can be the problem?

Viktor

October 14, 2009 10:12 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Victor: I'm just guessing, but it's likely that your previous experiments were multivariate experiments and your latest experiment was an a/b experiment. There's a known issue with a/b experiments that can cause referral issues.

There are a couple different workarounds; see Ophir's posts on the subject for more information. I personally prefer the first solution that he gives, but either one will work.

October 15, 2009 12:39 PM

Viktor said:

The strange thing is, that the latest experiment was multivariate experiment as well.

The refferer/cookie thing explains this phenomenon, because pageviews remained the same, while visits went up. So somehow the GWO (multivariate experiment) tracking script cleared my GA cookies and that's why GA counted pageviews after that as new (direct) visits.

But now I can't just figure it out, how/why did it happen.

October 15, 2009 8:26 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Do you have subdomains or multiple domains? This is the most common cause of cookie issues for multivariate tests. See Shawn's post on the subject for more information on handling these types of situations.

October 16, 2009 12:33 PM

David said:

It does seem like quite a useful script as it can be annoying and not as efficient to have more than one conversion script on a page.

Being able to adapt it to multiple conversion points would be wonderful, but maybe we fight one battle at a time.

thank you

October 19, 2009 7:48 PM

Martijn van Vreeden said:

Excellent suggestion. Thanks a lot!

October 20, 2009 7:26 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@David: You certainly could adapt the script to multiple conversion points, but it would make the script quite a bit more complicated. The nice thing about this script is that it indiscriminately registers a conversion for every test a visitor happens to be a part of.

In order to only register a conversion for a test if that conversion is a valid conversion point for that test, you'd have to store an array, probably in a cookie, of test ids and what conversion types are valid for each test id. If multiple conversion types are valid for a particular test id, that complicates things event further.

If someone wants to see what a script like that might look like, let me know. If someone does adapt this for multiple conversion points, feel free to post that script as well.

October 20, 2009 8:12 AM

Luke said:

Will this conversion script validate? I'm trying to validate locally for a multivariate test, but it isn't passing through. Should I validate using the standard conversion script but then use this modified one? Or should this modified version validate on its own?

October 20, 2009 4:09 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

Hi Luke,

The Google Website Optimizer validation is quite strict and will accommodate very few modifications, including this one. For a multivariate test, you should attempt to validate the script in order for Google Website Optimizer to recognize any sections you've added to the page.

The pop-up window should say that everything checked off OK except the conversion script. Click the Continue button in the pop-up window, then click the Continue button at the buttom of the page. A warning will pop up telling you that missing tags were detected, but you should click "Continue anyway". After that, you can proceed with the normal multivariate setup. The test should still run fine, even though the conversion script didn't validate.

For an A/B test, you can bypass validation altogether using GARE, you can use offline validation, or you can use a dummy conversion page. I personally just use GARE and don't worry about validation for A/B tests. You can always go back after bypassing validation and make sure that all of the other pages validate.

October 20, 2009 5:01 PM

Luke said:

Thanks Jeremy. I hate to keep bugging you about this, but I'm not seeing any conversions come through. I am tracking visits, but not conversions. According to Firebug, "universalCode is not defined". Any idea what could be causing this?

October 21, 2009 9:04 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: That's my fault. I made some quick changes to the code before posting it and didn't even manage to use the same function name. The code should work fine now.

October 21, 2009 9:23 AM

Luke said:

Jeremy- Thanks for the help. I've updated the code and performed multiple tests. While I'm no longer getting a JS error, I'm still not seeing the GWO conversion script firing in Firebug. I've set up another test, using different pages and standard GWO scripts, and can see the GWO conversion script fire in Firebug with that test.

Sorry to keep pestering you with this, but it's a great solution for a test that we're trying to push live and I'd love to be able to use it. Any sense of why the code isn't working?

October 21, 2009 10:08 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: A couple things to check:

1. Because the script dynamically registers conversion hits for any tests a visitor may be involved in, it's necessary to visit the test page in order to see a hit register when you visit the conversion page. The standard conversion script will register a hit regardless of whether or not a visitor has visited test page.

2. If the test spans multiple domains or subdomains, you'll need to make the appropriate modifications to your code to accommodate this. This is true for both the standard conversion code and the universal conversion code, but the universal code won't register a hit unless the cookies are available to it.

Basically, if the __utmx cookie is available on the conversion page, then there's an issue with the universal conversion script. If it's not available, then either you didn't visit the test page or there's a problem with the rest of the setup.

October 21, 2009 10:25 AM

Luke said:

Thanks Jeremy. I have definitely been visiting the test page every time and clearing cookies, testing different browsers, etc. The site is on a single domain and there are no modifications to either our GoAn script or the GWO scripts.

When I visit the test page, I can see the GWO tracking script fire. When I go from the test page to the conversion page, there is no GWO conversion script firing on the conversion page. I have quadruple checked all of the tracking/control scripts as well as the modified conversion script.

I've confirmed that another test with standard scripts works (using Firebug). I've confirmed that the GWO tracking scripts are working, but still not seeing any activity on the modified "universal conversion" script. Any chance that something is still off with the conversion script? I can't think of any other variables to test.

Again, I really appreciate all the help on this. Thanks.

October 21, 2009 10:37 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: What's the value of __utmx? It may be that there are some values that I haven't accounted for.

October 21, 2009 11:00 AM

Luke said:

Jeremy- Is this what you're looking for?

__utmx=1142584672.00006773452104898269:2:0-1

That was taken from utmx cookie on the test page.

Also seeing this in the JS paramaters on the test page:

utmxkey 2104898269
utmxtime 1256137612917
utmxx 142584672.00006570671805421827:2001673:2592000.00006773452104898269:2004920:2592000

October 21, 2009 11:10 AM

Michael Shearer said:

Hi,

What values do I need to replace in your script other than this one (UA-XXXXXXX-Y), if any?

Kindly,

Michael

October 21, 2009 12:39 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Luke: Everything seems to be working fine on my end. Unfortunately I can't think of anything else at this point that you can look into to resolve the issue. You could purchase a Google Website Optimizer support plan from us. This type of issue can most likely be resolved with a 1-hour plan, though there are also larger plans that give you a per/hour savings.

October 21, 2009 4:17 PM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Michael: That's basically all that needs changed. If you have any subdomain or multiple domain modifications, you'll need to add those as well, but that's true for any Google Website Optimizer test.

October 21, 2009 4:22 PM

Tom said:

Hi

Can you rewrite this code concerning new asynchronous GWO version? That would help a lot.
Thanks in advance!

Tom

June 15, 2011 9:43 AM

Jeremy Aube, Director of Engineering Author Profile Page said:

@Tom: It'd probably look something like this:

<script type="text/javascript">
function readCookie(name) { // function to read cookie
var nameRegex = RegExp("(?:; |^)" + name + "=([^;]+)");
nameValue = nameRegex.exec(document.cookie);
if(nameValue) {
return nameValue[1];
} else {
return null;
}
}
</script>

<script type="text/javascript">
(function () {
try {
_gaq.push(['gwo._setAccount', 'UA-XXXXXXX-Y']);
var utmx = readCookie("__utmx");
var pieces = utmx.split(/(?:^|:)[^.]*(?:\.|$)/);
for (i = 0; i < pieces.length; i += 1) {
if (pieces[i]) {
_gaq.push(['gwo._trackPageview', '/' + pieces[i].substring(10) + '/goal']);
}
}
} catch (err) { }
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

June 15, 2011 12:16 PM

Tom said:

Thanks a lot Jeremy!

June 16, 2011 4:05 AM

Post Your Comments

© 2002-2014 ROI Revolution, Inc. All rights reserved.