jtolentino
asked on
Setting flags for A/B testing on page being tested
Dear experts,
I'm doing some A/B testing on our company's store. We have some logic (written in JavaScript) that creates a visitor ID for new visitors (as a cookie), but this is loaded asynchronously after being pushed as Google Analytics (via _gaq.push). The value of this visitor ID (a number) is used in the A/B test, where odd numbered IDs go to page A and even numbered IDs to page B.
Occasionally however, a new user will land on the page being A/B tested. The dilemma is Google Analytics is not loaded yet, as is our JavaScript which sets the visitor ID, so we always end up with a zero result which goes to page B. Looking at the overall picture, we'll have more in page B due to this problem.
At the moment, the solution I've thought of involves checking with PHP if the visitor ID cookie exists. If it doesn't I'll have some sort of intermediate page whose sole purpose is just to set the visitor ID and then return the user back to the page they requested. It will all happen very quickly, but it produces a slightly annoying flicker
Do you see a more elegant solution to this or am I just going overboard with the annoying flicker?
Thanks in advance.
I'm doing some A/B testing on our company's store. We have some logic (written in JavaScript) that creates a visitor ID for new visitors (as a cookie), but this is loaded asynchronously after being pushed as Google Analytics (via _gaq.push). The value of this visitor ID (a number) is used in the A/B test, where odd numbered IDs go to page A and even numbered IDs to page B.
Occasionally however, a new user will land on the page being A/B tested. The dilemma is Google Analytics is not loaded yet, as is our JavaScript which sets the visitor ID, so we always end up with a zero result which goes to page B. Looking at the overall picture, we'll have more in page B due to this problem.
At the moment, the solution I've thought of involves checking with PHP if the visitor ID cookie exists. If it doesn't I'll have some sort of intermediate page whose sole purpose is just to set the visitor ID and then return the user back to the page they requested. It will all happen very quickly, but it produces a slightly annoying flicker
Do you see a more elegant solution to this or am I just going overboard with the annoying flicker?
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The dilemma is Google Analytics is not loaded yet, as is our JavaScript which sets the visitor IDI am confused though - if you put your code in a document ready function why would GA not be loaded yet?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the responses.
@leakim971: This looks quite promising. We actually need the data from Google's __utmz cookie (the cookie that stores information on how you got to the site). I haven't seen any mention of it, but we've identified some things that would simplify the task at hand.
@Ray_Paseur: Yes, we've actually started by trying to set to cookie in PHP. What we did was to generate the visitor ID independently, then just add logic later that gets the visitor's source information.
@julianH: We do the A/B test splitting on the server-side, so the page (and Google Analytics) doesn't load yet.
@leakim971: This looks quite promising. We actually need the data from Google's __utmz cookie (the cookie that stores information on how you got to the site). I haven't seen any mention of it, but we've identified some things that would simplify the task at hand.
@Ray_Paseur: Yes, we've actually started by trying to set to cookie in PHP. What we did was to generate the visitor ID independently, then just add logic later that gets the visitor's source information.
@julianH: We do the A/B test splitting on the server-side, so the page (and Google Analytics) doesn't load yet.
The point of cookies is to carry stateful information from request to request, so it's almost implicit in the design that new clients would be easy to identify since they would not have any cookie. Maybe there is a third state you want to design into consideration in addition to A/B.