Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Track custom events in Optimizely. The event eventName will be tracked and associated with the current visitor.

Description

The event method captures visitor behavior and additional data. You can track clicks and pageviews in Optimizely Performance Edge without code, but this API call supports tracking other behaviors like watching a video. These events can be used for measuring the results of an experiment or for identifying an audience based on behavior.

window.optimizelyEdge.push(event);
window.optimizelyEdge.push({
  "type": "event",
  "eventName": "watchedVideo",
  "tags": {
    "title": "Funny Cats",
    "duration": 30,
    "revenue": 5000
  }
});

Parameters

This table provides general information about the required and optional parameters.

ParameterTypeDescription
event
required
objectThis is an event object.
event.type
required
stringA static value that indicates that you're using the event function.
event.eventName
required
stringThe API name for an event created in Optimizely Performance Edge, e.g. add_to_cart.
event.tags
optional
objectA flat object containing metadata about an event (e.g., a product SKU). Some keys are reserved; see below for the list of such keys.
event.tags.revenue
optional
integerUsed to submit values for the revenue metric. Values of this tag should be integers equal to 100 times the unit value of the relevant currency (e.g., dollar, euro). For example, if a conversion results in $75.02 of revenue, then this tag should be included with value 7502.
event.tags.value
optional
numberUsed to submit values for numeric metrics that aren't revenue. If it's a number, it's included among both eventMetrics and eventFeatures in raw data export. If the value is not a number, this tag is still included among the eventFeatures present in raw data export, but is not among eventMetrics and is not used used in computing metric statistics.
event.tags.*
optional
string or integerUsed to specify additional properties of your choice.