Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. JavaScript Trackers (Web and Node.js)
  6. Browser Tracker
  7. Browser Tracker v3 Reference
  8. Plugins
  9. Optimizely Classic

Optimizely Classic

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() ], });
Code language: JavaScript (javascript)

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( <em>summary</em>: <em>boolean</em> = true, <em>experiments</em>: <em>boolean</em> = true, <em>states</em>: <em>boolean</em> = true, <em>variations</em>: <em>boolean</em> = true, <em>visitor</em>: <em>boolean</em> = true, <em>audiences</em>: <em>boolean</em> = true, <em>dimensions</em>: <em>boolean</em> = true )
Code language: HTML, XML (xml)

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

If you’d like to learn more about Snowplow Insights you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.