Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Event objects

Event objects

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


Each event object has the following fields:


pageview, click, or custom


A page name, click event name, or custom event name. If you filter by name, you probably want to filter by type as well.


A category name. All events with a given name and type will necessarily have the same category.

various tags

All events from a given page will have those pages' tag values, although additional or overridden tag values may be present on custom events.


Identifier 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).


The 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

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.


Identifies the type field.


Identifies the name field.


Identifies the category field.


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).