Skip to content

MarkBiesheuvel/optimizely-custom-code

Repository files navigation

Examples of custom code within Optimizely

This repository contains examples of custom code which can be used within Optimizely. The examples are organized into different categories.

Page activation trigger

Within an page definition you can use a custom page activation trigger to delay the activation of a page (and thus the experiments attached to it). For example, instead of activating the page when the website loads, you could activate the experiment after an user interaction.

Page condition

Instead of matching a page based on a URL pattern or on a CSS selector, it's also possible to write a custom JavaScript condition.

Project-level JavaScript

In your Optimizely project settings, you can add custom JavaScript code that will be run every time the Optimizely snippet is loaded. This can be used to configure custom attributes. Note that the optimizely object won't be initialized yet, so make sure to initialize this variable.

Experiment-level (Shared) Code

In an experiment, you can add custom JavaScript code that will be run for every variation. Note that this includes the original variation. This can be used to set up custom event tracking consistently across all variations.

Variation-level Code

Lastly, in a variation, you can add custom JavaScript code to create functional changes instead of just visual changes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published