Rich-text Reply

Targeting by Past Experiment

apatton 09-02-14

Targeting by Past Experiment

Hey all.

 

Quick question - I'd like target users who have seen a previous experiment. I know they're cookied with optimizelyBuckets. Can I use regex in the cookie value field? Or if someone has a smarter idea of how to do this (if user saw experiment A, now see experiment B) that'd be great too. 

 

Thanks!

 

- Alex

 

 

Level 1

Amanda 09-02-14
 

Re: Targeting by Past Experiment

Hey there! Can you tell us more about what you are hoping to test from a strategic perspective? Will both experiments be running at the same time, or is experiment A paused?

 

To answer your question, you can use custom JavaScript targeting and write some code that looks for a specific experiment ID in the optimizelyBuckets cookie. If the experiment ID is a substring match, the the boolean will return true and your new experiment will run. If the experiment ID is not a substring match, the boolean will return false and the new experiement will not run. 

 

For example, if wanted experiment B to only run for people who were previously bucketed into the experiment A (experiment ID 570101504), then you could use the code below to reference the optimizelyBuckets cookie value and look for a substring match. 

 

var match = document.cookie.match("optimizelyBuckets=([^;]*)");
match && match[1].indexOf("570101504") > -1;

For reference, you can use RegEx for cookie targeting, but you have to do this in the custom JavaScript targeting -- you can't use the cookie targeting option as it only accepts basic cookie names and/or cookies values. 

 

Does this help? Let me know if you have any questions on the above.

 

 

Optimizely