1. Integrating using REST APIs

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.

NameTypeDescriptionValues
actionstringVerb describing the action the user takes to cause the event to fire. Used with name to describe the type of event.addclickviewremoveidentifygetNoteYou can also use a verb describing a custom event.
namestringName of the event. Used with action to describe the type of event.Values depend on accompanying action value.
uuidstringAnonymous ID that you generate to track visitors.NoteEither uuid or user_id is required for all events.n/a
user_idstringOptional user ID that you use in your system. This is different from the uuid that you generate.NoteEither uuid or user_id is required for all events.n/a
valueobjectObject including details about the event and the visitor.n/a
value.contextobjectContext object including more information about the user, browser, location, and page.n/a
If you have suggestions for improving this article, let us know!