Preview:
import BaseTreatment, { teardownWithOptimizelyPages } from 'cromedics/classes/BaseTreatment';
import { pages } from 'optimizely.json';


class BasicTreatment extends BaseTreatment {
  constructor(variation) {
    super();
    this.variation = variation;
    teardownWithOptimizelyPages(this, pages);
  }
  apply() {
    super.apply();
    this.applyClass(TAG + this.variation); 

// code here
// use this.variation to access variation variable
//

  }
  teardown() {
    super.teardown();
  }
}

SHARED.applyTreatment = (variation) => {
  SHARED.treatment = SHARED.treatment || (SHARED.treatment = new BasicTreatment(variation));
  SHARED.treatment.on();
};
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter