Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 6.27 KB

File metadata and controls

44 lines (36 loc) · 6.27 KB

Home > @yext/analytics > EventPayload

EventPayload interface

The payload accepted by the Analytics Events API.

Signature:

export interface EventPayload 

Properties

Property Modifiers Type Description
action? Action (Optional) The user action which caused the event, e.g. ADD_TO_CART, THUMBS_UP, C_CUSTOM_ACTION
authorization? string (Optional) The authorization token for the request. This will be setup from the Key or Bearer in the config.
bot? boolean

(Optional) Whether the event is the result of bot activity.

If not specified the system will automatically detect whether this event originates from a bot.

browserAgent? { browser?: string; browserVersion?: string; device?: string; deviceClass?: string; os?: string; osVersion?: string; userAgent?: string; }

(Optional) Information about the visitors device and browser.

If not specified the system will automatically detect the values from request headers or userAgent property.

chat? { botId: string; conversationId?: string; responseId?: string; } (Optional) Fields specific to reporting Chat Analytics Events
clientSdk? Record<string, string> (Optional) For the Yext client SDKs involved in the event, this is an object mapping the names of those SDKs to the version labels of those SDKs.
count? number (Optional) When the record summarizes multiple events, the number of events the record represents. The event is treated as if it is duplicated this many times.
customTags? Record<string, string> (Optional) Up to 10 pairs matching custom string keys to string values to associate with the event. Keys are case-insensitive; values are case-sensitive.
customValues? Record<string, number> (Optional) Up to 10 pairs matching custom string keys to number values to associate with the event. Keys are case-insensitive.
destinationUrl? string (Optional) The URL of the page the event is directing the visitor to.
entity? string | number (Optional) The Yext entity to which the event corresponds. If passed as a string, the value is the mutable, customer-settable entity ID for the entity associated with the event. If passed as a number, it is the immutable entity ID (UID) set by the system. This is an internal ID.
internalUser? boolean (Optional) Indicates whether the event is the result of internal activity.
ip? { address: string; algorithm: string; } (Optional) The IP address for the event.
label? string (Optional) A label assigned to the event, e.g. a CTA label.
locale? string

(Optional) The locale of the user who generated the event.

If not specified the system will automatically determine the locale from the autogenerated Accept-Language header.

location? Coordinates | string

(Optional) The location information of the visitor for the event. Either a Coordinates object with both latitude and longitude or a string with the country of the visitor for the event, as a ISO 3166-1 alpha-2 country code. For more information see https://www.iso.org/iso-3166-country-codes.html.

If not specified the system will automatically determine all location information from the request's IP address, or the value of the ip property if specified.

pages? { scope?: string; originalEventName?: string; siteUid?: number; template?: string; } (Optional) Fields specific to reporting Yext Pages Analytics Events
pageUrl? string

(Optional) The URL of the page where the event occurred.

If not specified the system will automatically use document.URL

referrerUrl? string

(Optional) The URL of the page which the visitor came from prior to the event.

If not specified the system will automatically use document.referrer

search? { searchId?: string; queryId?: string; verticalKey?: string; isDirectAnswer?: boolean; versionLabel?: VersionLabel; versionNumber?: number; experienceKey: string; isGenerativeDirectAnswer?: boolean; } (Optional) Fields specific to reporting Yext Search Analytics Events
searchTerm? string (Optional) The query entered by the user.
sessionId? string | null (Optional) Unique identifier to tie together events in a single browsing session
timestamp? Date | string

(Optional) The timestamp at which the event occurred, in ISO format. For example, September 27, 2022 at 6 p.m. is represented as 2022-09-27 18:00:00.000. For more information, see https://www.iso.org/iso-8601-date-and-time-format.html.

If not specified the system will automatically use the time when the request was received in UTC as the event timestamp.

value? { amount: number; currency: string; } (Optional) The monetary value of the event.
visitor? Record<string, string> (Optional) Information used to associate analytics with a particular user.