initialized
Fires once the JavaScript API has been initialized.
Description
By this point, the Optimizely Performance Edge snippet will have processed all window.optimizelyEdge.push API calls that were made before the snippet began to execute or during Project JavaScript.
window.optimizelyEdge.get will now be defined in addition to window.optimizelyEdge.push, although visitor-specific state data (such as that returned by get('visitor') and get('state').getCampaignStates()) may not have been determined yet.
The snippet only initializes once per browser page load.
var initialized = function(initialized);function onInitialized(event) {
console.log("Project " + window.optimizelyEdge.get("data").projectId + " is initialized");
}
window.optimizelyEdge = window.optimizelyEdge || [];
window.optimizelyEdge.push({
type: "addListener",
filter: {
type: "lifecycle",
name: "initialized"
},
handler: onInitialized
});Parameters
This table provides general information about required and optional parameters.
Parameter | Type | Description |
|---|---|---|
initialized required | object | This is the object passed to the handler function. |
initialized.type required | string | The category of an event. The value will be lifecycle for this event. |
initialized.name optional | string | The name of the event type. This is set to initialized. |