Rich-text Reply

Conditional Activation based on skus in shopping cart?

mstrong 03-21-17

Conditional Activation based on skus in shopping cart?

It's been requested of me to try to create a conditional upsell graphic that only appears in the cart when certain skus are present.  In this case it's a short list of 4 or 5.  I'm not super-javascript-savvy, but I can get around.  What I'm trying to figure out is how to set up the conditional activation in this case.  There are elements in the page source (and we use Tealium, so I have data in the utag I can poach) that would be consistent enough to look for the skus, but I'm not sure of the best approach here. For reference, this is www.yankeecandle.com.  Has anybody attempted an experiment like this?

Level 2

JasonDahlin 03-21-17
 

Re: Conditional Activation based on skus in shopping cart?

A couple of ways to approach this:

1- Let the experiment run for everyone but onlky "do something" if the selected SKUs are present on the page.  The upside of this is that it's very straightforward.  The downside is that your cohort groups will include users who are not subject to the actual experiment.

2- use conditional activation as you mentioned.  To do this, either create an normal experiment (runs for everyone) with only one variation.  In that variation, write the code that looks for a SKU in the list and if present activates the real experiment.  Or, use Tealium to insert the script that does the same.

 

See here for details on how to set up Conditional Activation:

https://help.optimizely.com/Build_Campaigns_and_Experiments/Activation_Mode%3A_Activating_an_experim...

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
jason-gsell 03-22-17
 

Re: Conditional Activation based on skus in shopping cart?

Hey @mstrong this is a fantastic question for our Ask the Expert column right with with Tom Fuertes, CTO of our three-star solutions partner, CROMetrics. 

 

If you'd like Tom's opinion (and I'd recommend it) feel free to post your question here

If this solved your question, please accept it as a solution!
Optimizely
mstrong 03-22-17
 

Re: Conditional Activation based on skus in shopping cart?

I found a solution using the Tealium Data Layer (thanks to Tom Fuertes):
function (activate) {

// populate an array with sku's to look for
var skus = '12345,67890'.split(',');

// poll for utag_data and activate if sku in cart
(function poll() {
var utag_data = window.utag_data;
if (!utag_data) return setTimeout(poll, 50);
var product_sku = utag_data.product_sku || [];
var shouldActivate = false;
product_sku.forEach(function (sku) {
if (skus.indexOf(sku)>=0) {
shouldActivate = true;
}
});
if (shouldActivate) activate();
})();

}
Level 2