Functions
This topic describes how Optimizely Web Experimentation's (fka Optimizely X) various functions differ from Optimizely Classic.
Activate
_Available in Optimizely Web Experimentation: Yes, but in a different format.
Classic format:
window["optimizely"].push(["activate"]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "activate"
});
In Optimizely Classic, the activate function was used to activate all manually activated experiments. In Optimizely Web Experimentation, 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 does not work for Optimizely Web Experimentation. Instead, there is a new function in Optimizely Web Experimentation 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 Web Experimentation: Yes, but in a different format.
Classic format:
window["optimizely"].push(["activate", experimentId]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "page",
"pageName": "watchedVideo",
});
In Optimizely Classic, the activate function was used to activate one manually activated experiment. In Optimizely Web Experimentation, activation happens at the page level. By activating a page, all associated experiments and campaigns are activated.
In Optimizely Web Experimentation, you can manually activate a page with the Page function.
Activate SiteCatalyst
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push("activateSiteCatalyst");
Optimizely Web Experimentation format:
// It's exactly the same format
window["optimizely"].push("activateSiteCatalyst");
Continues to work in Optimizely Web Experimentation.
Activate SiteCatalyst with sVar
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["activateSiteCatalyst", {"sVariable": mySVar}]);
Optimizely Web Experimentation format:
// It's exactly the same format
window["optimizely"].push(["activateSiteCatalyst", {"sVariable": mySVar}]);
Continues to work in Optimizely Web Experimentation.
Audiences
Available in Optimizely Web Experimentation: 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 Web Experimentation: Yes
Classic format:
window["optimizely"].push(["bucketVisitor", experimentId, variationId]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "bucketVisitor",
"experimentId": "6661191859",
"variationId": "238497929"
});
Continues to work in Optimizely Web Experimentation.
Bucket visitor by variation index
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["bucketVisitor", experimentId, variationIndex]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "bucketVisitor",
"experimentId": "6661191859",
"variationIndex": 1
});
Continues to work in Optimizely Web Experimentation.
Custom tag
Available in Optimizely Web Experimentation: No, but it i possible to achieve the same with page activation.
Classic format:
window["optimizely"].push(["customTag", tagKey, tagValue]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "page",
"pageName": "watchedVideo",
});
Custom tags are replaced by page activation in Optimizely Web Experimentation.
Delay pageview tracking
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["delayPageviewTracking", 1000]);
Optimizely Web Experimentation format:
window["optimizely"].push(["delayPageviewTracking", 1000]);
Continues to work in Optimizely Web Experimentation.
Set dimension value
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(['setDimensionValue', dimensionId, 'value']);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "user",
"attributes": {
"frequentFlyerStatus": "Gold",
"frequentFlyerMiles": 25600
}
});
Continues to work in Optimizely Optimizely Web Experimentation. Dimensions are called user attributes in Optimizely Web Experimentation. They work the same.
Disable
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["disable"]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "disable"
});
Continues to work in Optimizely Web Experimentation.
Disable tracking
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["disable", "tracking"]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "disable",
"scope": "tracking"
});
Continues to work in Optimizely Web Experimentation.
Log
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["log"]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "log",
"level": "INFO"
});
Continues to work in Optimizely Web Experimentation. Learn more about different log levels.
Set cookie expiration
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["setCookieExpiration", 365]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "cookieExpiration",
"cookieExpirationDays": 365
});
Continues to work in Optimizely Web Experimentation.
Set cookie domain
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["setCookieDomain", "[www.example.com](http://www.example.com)"]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "cookieDomain",
"cookieDomain": "www.example.com"
});
Continues to work in Optimizely Web Experimentation.
Skip page tracking
Available in Optimizely Web Experimentation: No
Classic format:
window["optimizely"].push(["skipPageTracking"]);
No longer supported in Optimizely Web Experimentation.
Third-Party cookie opt-out
Available in Optimizely Web Experimentation: Unnecessary
Classic format:
window["optimizely"].push(["optOutThirdPartyCookies"]);
As Optimizely Web Experimentation does not use third-party cookies, this function is no longer necessary.
Event tracking
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["trackEvent", "watchedVideo"]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "event",
"eventName": "watchedVideo",
});
Continues to work in Optimizely Web Experimentation. In Optimizely Classic, it was possible to track goals that weren't created in the UI yet. In Optimizely Web Experimentation, an event must be created before using it. Events are the rough equivalent in Optimizely Web Experimentation of Events in Optimizely Classic.
Revenue tracking
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["trackEvent", "watchedVideo", {"revenue": 5000}]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "event",
"eventName": "watchedVideo",
"tags": {
"revenue": 5000
}
});
Continues to work in Optimizely Web Experimentation.
Visitor opt-out
Available in Optimizely Web Experimentation: Yes
Classic format:
window["optimizely"].push(["optOut"]);
Optimizely Web Experimentation format:
window["optimizely"].push({
"type": "optOut"
});
Continues to work in Optimizely Web Experimentation.
Visitor segments
Available in Optimizely Web Experimentation: 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 Web Experimentation, it has been replaced by the Custom Attribute API.
Updated almost 2 years ago