EventData

Version:

Type

Interface

Extends

EventAttributesInput

Import path

@sitecore-cloudsdk/events/server

Data for custom events.

Signature

export interface EventData extends EventAttributesInput, NestedObject {
  type: string;
  extensionData?: ExtensionData;
  searchData?: NestedObject;
}

Properties

Name

Type

Description

Value

type

string

Required.

The type of the event.

To send a custom event using event, or to add a custom event to the event queue using addToEventQueue, set type to a unique value. Do not set type to a reserved event name.

Recommendation: Include the name of the site in the unique value, for example, "myretailsite:CLICKED_PROMO".

Reserved event names:

  • Any event name starting with "SC_".

  • "ADD" - standard ADD event.

  • "ADD_CONSUMERS" - standard ADD_CONSUMERS event.

  • "ADD_CONTACTS" - standard ADD_CONTACTS event.

  • "CAMPAIGN_TRACKING" - internally reserved event. Do not use.

  • "CHECKOUT" - standard CHECKOUT event.

  • "CLEAR_CART" - standard CLEAR_CART event.

  • "CONFIRM" - standard CONFIRM event.

  • "FEEDBACK" - FEEDBACK event.

  • "IDENTITY" - standard IDENTITY event.

  • "INTERACTION" - internally reserved event. Do not use.

  • "ORDER_CHECKOUT" - standard ORDER_CHECKOUT event.

  • "PAYMENT" - standard PAYMENT event.

  • "SUBSCRIPTION" - internally reserved event. Do not use.

  • "SEARCH" - standard SEARCH event.

  • "TRACKING" - internally reserved event. Do not use.

  • "VIEW" - standard VIEW event.

To send a standard event using event, set type to the standard event name, such as ORDER_CHECKOUT or SC_SEARCH_WIDGET_VIEW.

We recommend that you send standard events using their dedicated functions instead of the event function. For example, send an IDENTITY event using the identity function.

"myretailsite:CLICKED_PROMO"

extensionData

ExtensionData

Optional.

Any custom data to collect about an event in addition to the other attributes provided for the event data.

{ customKey: "customValue" }

searchData

NestedObject

Optional.

Important

Requires a Sitecore Search subscription.

Sitecore Search data about the event.

Use only in the following, standard events:

  • SC_SEARCH_WIDGET_VIEW

  • SC_SEARCH_WIDGET_CLICK

If set, the event and all its data will be available in Sitecore Search.

Construct according to the Sitecore Search Events API reference and data model.

N/A

Examples

Example 50. Custom event

Here's a basic event data object for a custom event named "myretailsite:CLICKED_PROMO":

const eventData: any = {
  type: "myretailsite:CLICKED_PROMO"
};


Example 51. Custom event with optional data
const eventData: any = {
  type: "myretailsite:CLICKED_PROMO",
  language: "EN",
  page: "home",
  channel: "WEB",
  currency: "EUR",
  extensionData: { customKey: "customValue" }
};


Example 52. SC_SEARCH_WIDGET_VIEW event

Here's an example event data object for a SC_SEARCH_WIDGET_VIEW event with search data:

XM Cloud is now SitecoreAI

Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.



Example 53. SC_SEARCH_WIDGET_CLICK event for an item

Here's an example event data object for a SC_SEARCH_WIDGET_CLICK event with search data. This object describes a click event on an item:



Example 54. SC_SEARCH_WIDGET_CLICK event for a facet

Here's an example event data object for a SC_SEARCH_WIDGET_CLICK event with search data. This object describes a click event on a facet:



Example 55. SC_SEARCH_WIDGET_CLICK event for a suggestion

Here's an example event data object for a SC_SEARCH_WIDGET_CLICK event with search data. This object describes a click event on a suggestion:



If you have suggestions for improving this article, let us know!