Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideProduct feedbackGitHubNuGetDev CommunitySubmit a ticketLog In

Event objects

Describes events, which are one of the core concepts of Optimizely Personalization. In the context of customer behavior, these events are exposed as JavaScript objects.

Event object fields

Each event object has the following fields:

typepageview, click, or custom
nameA page name, click event name, or custom event name. If you filter by name, you probably want to filter by type as well.
categoryA category name. All events with a given name and type will necessarily have the same category.
various tagsAll events from a given page will have those pages' tag values, although additional or overridden tag values may be present on custom events.
session_indexIdentifier for the session in which the event occurred. The sessions are indexed such that the current session is 0, the previous session is 1, and each subsequent session_index is one more than the session that follows it (chronologically).
timeThe time at which the event occurred (number of milliseconds after January 1, 1970).

Each field can be a number, a Boolean, or a string.

Tag fields may also be undefined or some arbitrary JSON value, so be prepared for anything if you're retrieving tag values using the query API.

// A single event
  "type": "pageview",
  "name": "full_product_page",
  "category": "product_detail",
  "tags": {
    "product_sku": "428977",
    "product_desc": "Clamshell Button 12mm",
    "product_cat": "button"
  "session_index": 2,
  "time": 1447046231000

Event object field identifiers

When defining a behavioral query, you may need to refer to a particular event field. You can do this using field identifiers.

For top-level fields like time, the identifier is an array containing the name of the field.

["type"]Identifies the type field.
["name"]Identifies the name field.
["category"]Identifies the category field.
["time"]Identifies the time field.

For tag fields, the identifier is an array containing the string "tags" and then the name of the tag.

["tags", "material"]Identifies the material tag.
["tags", "color"]Identifies the color tag.
["tags", "revenue"]Identifies the special revenue tag. Its value is extracted in Optimizely's analytics backend and used to compute advanced statistics.

When filtering, you can also refer to an event's age. age isn't a real event field so is never actually included in event objects (compare with time). ["age"] identifies the amount of time since an event occurred (number of milliseconds before the time at which the query is executed).