The Full Stack Developer Guide Developer Hub

Welcome to the Full Stack Developer Guide developer hub. You'll find comprehensive guides and documentation to help you start working with the Full Stack Developer Guide as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Functions

Activate

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].push(["activate"]);

Optimizely X format:

window["optimizely"].push({
  "type": "activate"
});

In Optimizely Classic the activate function was used to activate all manually activated experiments. In Optimizely X activation happens at the page level.

Due to the different nature of the activate function, the activate function as it was available in Optimizely Classic doesn't work for Optimizely X. Instead there's a new function in Optimizely X for window["optimizely"].push({type: "activate"});. The function differs from the activate function in Optimizely Classic but has the same goal. The difference is that the entire Optimizely execution cycle is (re)activated.

You can read more about the new activate method here.

Activate a single experiment

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].push(["activate", experimentId]);

Optimizely X format:

window["optimizely"].push({
  "type": "page",
  "pageName": "watchedVideo",
});

In Optimizely Classic the activate function was used to activate one manually activated experiment. In Optimizely X activation happens at the page level. By activating a page, all associated experiments and campaigns are activated.

In Optimizely X you can manually activate a page with the Page function.

Activate SiteCatalyst

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push("activateSiteCatalyst");

Optimizely X format:

// It's exactly the same format
window["optimizely"].push("activateSiteCatalyst");

Continues to work in Optimizely X.

Activate SiteCatalyst with sVar

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["activateSiteCatalyst", {"sVariable": mySVar}]);

Optimizely X format:

// It's exactly the same format
window["optimizely"].push(["activateSiteCatalyst", {"sVariable": mySVar}]);

Continues to work in Optimizely X.

Audiences

Available in Optimizely X: No

Classic format:

window["optimizely"].push(['addToAudience', audienceId]);
window["optimizely"].push(['removeFromAudience', audienceId]);
window["optimizely"].push(['removeFromAllAudiences']);

Not available. An alternative solution for these functions will be available soon.

Bucket visitor by variation ID

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["bucketVisitor", experimentId, variationId]);

Optimizely X format:

window["optimizely"].push({
  "type": "bucketVisitor",
  "experimentId": "6661191859",
  "variationId": "238497929"
});

Continues to work in Optimizely X.

Bucket visitor by variation index

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["bucketVisitor", experimentId, variationIndex]);

Optimizely X format:

window["optimizely"].push({
  "type": "bucketVisitor",
  "experimentId": "6661191859",
  "variationIndex": 1
});

Continues to work in Optimizely X.

Custom tag

Available in Optimizely X: No, but it's possible to achieve the same with page activation.

Classic format:

window["optimizely"].push(["customTag", tagKey, tagValue]);

Optimizely X format:

window["optimizely"].push({
  "type": "page",
  "pageName": "watchedVideo",
});

Custom tags are replaced by page activation in Optimizely X.

Delay pageview tracking

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["delayPageviewTracking", 1000]);

Optimizely X format:

window["optimizely"].push(["delayPageviewTracking", 1000]);

Continues to work in Optimizely X.

Set dimension value

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(['setDimensionValue', dimensionId, 'value']);

Optimizely X format:

window["optimizely"].push({
  "type": "user",
  "attributes": {
    "frequentFlyerStatus": "Gold",
    "frequentFlyerMiles": 25600
  }
});

Continues to work in Optimizely X. Dimensions are called user attributes in Optimizely X. They work the same.

Disable

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["disable"]);

Optimizely X format:

window["optimizely"].push({
  "type": "disable"
});

Continues to work in Optimizely X.

Disable tracking

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["disable", "tracking"]);

Optimizely X format:

window["optimizely"].push({
  "type": "disable",
  "scope": "tracking"
});

Continues to work in Optimizely X.

Log

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["log"]);

Optimizely X format:

window["optimizely"].push({
  "type": "log",
  "level": "INFO"
});

Continues to work in Optimizely X. Learn more about different log levels.

Set cookie expiration

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["setCookieExpiration", 365]);

Optimizely X format:

window["optimizely"].push({
  "type": "cookieExpiration",
  "cookieExpirationDays": 365
});

Continues to work in Optimizely X.

Set cookie domain

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["setCookieDomain", "[www.example.com](http://www.example.com)"]);

Optimizely X format:

window["optimizely"].push({
  "type": "cookieDomain",
  "cookieDomain": "www.example.com"
});

Continues to work in Optimizely X.

Skip page tracking

Available in Optimizely X: No

Classic format:

window["optimizely"].push(["skipPageTracking"]);

No longer supported in Optimizely X.

Third-Party cookie opt out

Available in Optimizely X: Unnecessary

Classic format:

window["optimizely"].push(["optOutThirdPartyCookies"]);

As Optimizely X doesn't use third-party cookies, this function is no longer necessary.

Event tracking

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["trackEvent", "watchedVideo"]);

Optimizely X format:

window["optimizely"].push({
  "type": "event",
  "eventName": "watchedVideo",
});

Continues to work in Optimizely X. In Optimizely Classic it was possible to track goals that weren't created in the UI yet. In Optimizely X an event must be created before using it. Events are the rough equivalent in Optimizely X of Events in Optimizely Classic.

Revenue tracking

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["trackEvent", "watchedVideo", {"revenue": 5000}]);

Optimizely X format:

window["optimizely"].push({
  "type": "event",
  "eventName": "watchedVideo",
  "tags": {
    "revenue": 5000
  }
});

Continues to work in Optimizely X.

Visitor opt out

Available in Optimizely X: Yes

Classic format:

window["optimizely"].push(["optOut"]);

Optimizely X format:

window["optimizely"].push({
  "type": "optOut"
});

Continues to work in Optimizely X.

Visitor segments

Available in Optimizely X: No

Classic format:

window["optimizely"].push(['addToSegment', 'apiIdentifier', 'optionalSegmentValue']);
window["optimizely"].push(['removeFromSegment', 'apiIdentifier']);
window["optimizely"].push(['removeFromAllSegments']);

The Segment API was replaced by the Dimension API and now, in Optimizely X, has been replaced by the Custom Attribute API.

Updated about a year ago


Functions


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.