• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

A/B Test


I was wondering if this logic would work for an A/B test.  Prior to the Google Analytics code running, I was hoping to make a call to  a database that will simply hold a flag of 1 or 0.  Can I have some logic at the top of my index that calls the database and if a 1 is returned show them version A and if 0 is returned show them version B?

I'm asking if you guys think this logic will work for an A/B test?

2 Solutions
Sure, you didn't really say what you are toggling between; different page views?

Here are a couple of extra thoughts.   Are you playing on changing the value from 1 to 0 and back each time the page is shown?  That way you show page A then page B alternating?    But consider that User A should always see the same page view to keep from getting confused.  So perhaps when the user first goes to the site the view he going to see is determined and set in a session variable or a cookie.   Then from then on, he will see that page view.   The next user goes to the site, gets his view assigned to a cookie or session variable and then from then on sees Page B view, etc...
I have a toggle in place that when I have to take the site down for some reason I can switch it in the DB.

<cfif toggle eq 1>
<cfinclude template="live.cfm">
<cfinclude template="dead.cfm">

Open in new window

Obviously that is an over simplified example but I hope it triggers something that might work for you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now