Using the Events API to track events

As visitors interact with your page by clicking on widgets, logging in, upvoting articles, and so on, you must track those interactions and send them to Sitecore Search using the Events API.

Sitecore Search uses events for generating analytic dashboards and driving personalization. If you track events thoroughly and accurately, you get more useful site analytics, and your site visitors get more personalized content.

To track visitor interactions, you must correctly construct the associated event object, call the Events API, and send the object using the API.

Important

You must send certain events for Search to work as expected.

Event types and required attributes

You can track many different types of events using the Sitecore Search Events API. Sitecore Search provides event actions and names that can be combined to create a variety of events.

Sitecore Search supports the following categories of events:

Note

For the event object data model, see the Events API reference.

The following lists the required attributes for all event objects:

Important

Different events have different required attributes in addition to the following. See the individual event types for the required attributes.

Name

Type

Description

Values

action

string

Verb describing the action the user takes to cause the event to fire. Used with name to describe the type of event.

  • add

  • click

  • view

  • remove

  • identify

  • get

Note

You can also use a verb describing a custom event.

name

string

Name of the event. Used with action to describe the type of event.

Values depend on accompanying action value.

uuid

string

Anonymous ID that you generate to track visitors.

Note

Either uuid or user_id is required for all events.

n/a

user_id

string

Optional user ID that you use in your system. This is different from the uuid that you generate.

Note

Either uuid or user_id is required for all events.

n/a

value

object

Object including details about the event and the visitor.

n/a

value.context

object

Context object including more information about the user, browser, location, and page.

n/a

Do you have some feedback for us?

If you have suggestions for improving this article,