Skip to main content

Optimizely Classic

caution
You are reading documentation for an outdated version. Here’s the latest one!

Installation

  • npm install @snowplow/browser-plugin-optimizely
  • yarn add @snowplow/browser-plugin-optimizely
  • pnpm add @snowplow/browser-plugin-optimizely

Initialization

import { newTracker, trackPageView } from '@snowplow/browser-tracker';
import { OptimizelyPlugin } from '@snowplow/browser-plugin-optimizely';

newTracker('sp1', '{{collector_url}}', {
appId: 'my-app-id',
plugins: [ OptimizelyPlugin() ],
});

The constructor parameters allow for configuration of the contexts to include. If you do not specify any, all the Optimizely contexts will be included. To alter this behavior you can flip some of the booleans. The constructor has the following definition:

OptimizelyPlugin(
summary: boolean = true,
experiments: boolean = true,
states: boolean = true,
variations: boolean = true,
visitor: boolean = true,
audiences: boolean = true,
dimensions: boolean = true
)

Context

Adding this plugin will automatically capture the following context:

Context

| iglu:com.optimizely.snowplow/optimizely_summary/jsonschema/1-0-0
iglu:com.optimizely/experiment/jsonschema/1-0-0
iglu:com.optimizely/state/jsonschema/1-0-0
iglu:com.optimizely/variation/jsonschema/1-0-0
iglu:com.optimizely/visitor/jsonschema/1-0-0
iglu:com.optimizely/visitor_audience/jsonschema/1-0-0
iglu:com.optimizely/visitor_dimension/jsonschema/1-0-0 |