activated
3 min
Fires each time the Optimizely Performance Edge snippet activates.
Description
At this point, the Optimizely Performance Edge snippet has been activated, and you can query for visitor state such as:
- Visitor ID.
- Page states (getActivePages). A Page will be included if it was found to be active in the Edge Decider.
Experiment states (getActiveExperiments), for experiments that:
- Specify changes to active pages (see above), and
- Target audiences that the Edge Decider was able to evaluate using data provided.
var activated = function(activated);function onActivated(event) {
var visitorId = window.optimizelyEdge.get('visitor_id').randomId;
console.log("The visitor's ID is: " + visitorId);
}
window.optimizelyEdge = window.optimizelyEdge || [];
window.optimizelyEdge.push({
type: "addListener",
filter: {
type: "lifecycle",
name: "activated"
},
handler: onActivated
});Parameters
This table provides general information about required and optional parameters.
Parameter | Type | Description |
|---|---|---|
activated required | object | This is the object passed to the handler function. |
activated.type required | string | The category of an event. The value will be lifecycle for this event. |
activated.name optional | string | The name of the event type. This is set to activated. |