Skip to main content

THSL-46 [Subscription Flow][All Users] Combine Protein & Allergy Question

Hello Thistle Devs,

This package contains all of the information that we used to create this experiment in Convert. It contains the original source code written by our engineer to produce the experiment.

View the Experiment Details

This code may include ECMAScript 2015 features not natively supported by all browsers (such as Internet Explorer). In order to support older browsers, we run all source code through Babel before deploying to the testing platform. You may use the online conversion tool if you don't already have Babel integrated into your development workflow. We also use SASS CSS compiler, and PostCSS Autoprefixer.

We are happy to answer any questions you may have regarding any of this. Please reach out to your account contact or you can send an email to engineering@crometrics.com for support.

Target Pages

Source Code

This runs on all targeted pages in all variations:

(function(TAG){
const id=100330669;

const SHARED = window[`CRO_SHARED_`+id] || (window[`CRO_SHARED_`+id] = {});

const utils = window.CRO_PJS && window.CRO_PJS.utils;
const log = utils.log && utils.log.bind(window, `[${TAG}]`) || console.warn.bind(window, `[cro] [${TAG}]`);
utils.error && utils.error.bind(window, TAG) || console.error.bind(window, `[cro] [${TAG}]`);
const init = (variation, el = document.documentElement)=>{
  el.classList.add(TAG);
  el.classList.add(TAG+variation);
  log(`Variation ${variation}`);
};

// eslint-disable-next-line no-unused-vars
log('v0.1');

SHARED.applyTreatment = variation=>{
  init(variation);

};
})('thsl46');
View the original experience.js source
// eslint-disable-next-line no-unused-vars
import { SHARED, utils, log, error, init } from 'base';
log('v0.1');

SHARED.applyTreatment = variation=>{
  init(variation);

};

This runs on all targeted pages in variation v1:

(function(TAG,VARIATION){
const id=100330669;

const SHARED = window[`CRO_SHARED_`+id] || (window[`CRO_SHARED_`+id] = {});

const utils = window.CRO_PJS && window.CRO_PJS.utils;
utils.log && utils.log.bind(window, `[${TAG}]`) || console.warn.bind(window, `[cro] [${TAG}]`);
const error = utils.error && utils.error.bind(window, TAG) || console.error.bind(window, `[cro] [${TAG}]`);

// eslint-disable-next-line no-unused-vars
try{
  SHARED.applyTreatment(VARIATION);
}catch(e){
  error(e);
}
})('thsl46','v1');
View the original v1.js source
// eslint-disable-next-line no-unused-vars
import { SHARED, utils, log, error, init } from 'base';
try{
  SHARED.applyTreatment(VARIATION);
}catch(e){
  error(e);
}

Previews

This test may or may not still be running by the time you are reading this. You can run this code on target pages by pasting the following scripts into your browser's DevTools console window.

Run v0:

window.CRO_PJS.setMode('log');!function(n){var o=100330669,i=window["CRO_SHARED_"+o]||(window["CRO_SHARED_"+o]={}),c=window.CRO_PJS&&window.CRO_PJS.utils,d=c.log&&c.log.bind(window,"[".concat(n,"]"))||console.warn.bind(window,"[cro] [".concat(n,"]"));c.error&&c.error.bind(window,n)||console.error.bind(window,"[cro] [".concat(n,"]"));d("v0.1"),i.applyTreatment=function(o){!function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;i.classList.add(n),i.classList.add(n+o),d("Variation ".concat(o))}(o)}}("thsl46");

Run v1:

window.CRO_PJS.setMode('log');!function(n){var o=100330669,i=window["CRO_SHARED_"+o]||(window["CRO_SHARED_"+o]={}),c=window.CRO_PJS&&window.CRO_PJS.utils,d=c.log&&c.log.bind(window,"[".concat(n,"]"))||console.warn.bind(window,"[cro] [".concat(n,"]"));c.error&&c.error.bind(window,n)||console.error.bind(window,"[cro] [".concat(n,"]"));d("v0.1"),i.applyTreatment=function(o){!function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;i.classList.add(n),i.classList.add(n+o),d("Variation ".concat(o))}(o)}}("thsl46");!function(o,n){var w=100330669,r=window["CRO_SHARED_"+w]||(window["CRO_SHARED_"+w]={}),i=window.CRO_PJS&&window.CRO_PJS.utils;i.log&&i.log.bind(window,"[".concat(o,"]"))||console.warn.bind(window,"[cro] [".concat(o,"]"));var c=i.error&&i.error.bind(window,o)||console.error.bind(window,"[cro] [".concat(o,"]"));try{r.applyTreatment("v1")}catch(o){c(o)}}("thsl46");