diff --git a/docs/analytics.eventpayload.bot.md b/docs/analytics.eventpayload.bot.md index b028734..e40dedd 100644 --- a/docs/analytics.eventpayload.bot.md +++ b/docs/analytics.eventpayload.bot.md @@ -6,6 +6,8 @@ Whether the event is the result of bot activity. +If not specified the system will automatically detect whether this event originates from a bot. + **Signature:** ```typescript diff --git a/docs/analytics.eventpayload.browseragent.md b/docs/analytics.eventpayload.browseragent.md index bd96e45..83e89b8 100644 --- a/docs/analytics.eventpayload.browseragent.md +++ b/docs/analytics.eventpayload.browseragent.md @@ -6,6 +6,8 @@ Information about the visitors device and browser. +If not specified the system will automatically detect the values from request headers or `userAgent` property. + **Signature:** ```typescript diff --git a/docs/analytics.eventpayload.locale.md b/docs/analytics.eventpayload.locale.md index b24e2d7..4f1d1c3 100644 --- a/docs/analytics.eventpayload.locale.md +++ b/docs/analytics.eventpayload.locale.md @@ -6,6 +6,8 @@ The locale of the user who generated the event. +If not specified the system will automatically determine the locale from the Accept-Language header. + **Signature:** ```typescript diff --git a/docs/analytics.eventpayload.location.md b/docs/analytics.eventpayload.location.md index 4f4bf03..4792303 100644 --- a/docs/analytics.eventpayload.location.md +++ b/docs/analytics.eventpayload.location.md @@ -6,6 +6,8 @@ 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. +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. + **Signature:** ```typescript diff --git a/docs/analytics.eventpayload.md b/docs/analytics.eventpayload.md index 195de78..47db9af 100644 --- a/docs/analytics.eventpayload.md +++ b/docs/analytics.eventpayload.md @@ -18,8 +18,8 @@ export interface EventPayload | --- | --- | --- | --- | | [action?](./analytics.eventpayload.action.md) | | [Action](./analytics.action.md) | _(Optional)_ The user action which caused the event, e.g. ADD\_TO\_CART, THUMBS\_UP, C\_CUSTOM\_ACTION | | [authorization?](./analytics.eventpayload.authorization.md) | | string | _(Optional)_ The authorization token for the request. This will be setup from the Key or Bearer in the config. | -| [bot?](./analytics.eventpayload.bot.md) | | boolean | _(Optional)_ Whether the event is the result of bot activity. | -| [browserAgent?](./analytics.eventpayload.browseragent.md) | | { browser?: string; browserVersion?: string; device?: string; deviceClass?: string; os?: string; osVersion?: string; userAgent?: string; } | _(Optional)_ Information about the visitors device and browser. | +| [bot?](./analytics.eventpayload.bot.md) | | 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?](./analytics.eventpayload.browseragent.md) | | { 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?](./analytics.eventpayload.chat.md) | | { botId: string; conversationId?: string; responseId?: string; } | _(Optional)_ Fields specific to reporting Chat Analytics Events | | [clientSdk?](./analytics.eventpayload.clientsdk.md) | | 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?](./analytics.eventpayload.count.md) | | 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. | @@ -30,15 +30,23 @@ export interface EventPayload | [internalUser?](./analytics.eventpayload.internaluser.md) | | boolean | _(Optional)_ Indicates whether the event is the result of internal activity. | | [ip?](./analytics.eventpayload.ip.md) | | { address: string; algorithm: string; } | _(Optional)_ The IP address for the event. | | [label?](./analytics.eventpayload.label.md) | | string | _(Optional)_ A label assigned to the event, e.g. a CTA label. | +<<<<<<< HEAD | [locale?](./analytics.eventpayload.locale.md) | | string | _(Optional)_ The locale of the user who generated the event. | | [location?](./analytics.eventpayload.location.md) | | 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. | | [pages?](./analytics.eventpayload.pages.md) | | { scope?: string; siteUid?: number; template?: string; } | _(Optional)_ Fields specific to reporting Yext Pages Analytics Events | | [pageUrl?](./analytics.eventpayload.pageurl.md) | | string | _(Optional)_ The URL of the page where the event occurred | | [referrerUrl?](./analytics.eventpayload.referrerurl.md) | | string | _(Optional)_ The URL of the page which the visitor came from prior to the event. | +======= +| [locale?](./analytics.eventpayload.locale.md) | | string |

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

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

| +| [location?](./analytics.eventpayload.location.md) | | 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.

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?](./analytics.eventpayload.pages.md) | | { siteUid?: number; template?: string; } | _(Optional)_ Fields specific to reporting Yext Pages Analytics Events | +| [pageUrl?](./analytics.eventpayload.pageurl.md) | | string |

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

If not specified the system will automatically use the Referer header of the request.

| +| [referrerUrl?](./analytics.eventpayload.referrerurl.md) | | string |

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

If not specified the system will automatically use the Referer header of the request.

| +>>>>>>> 13bbe96 (Automated update to repo's documentation from github action) | [search?](./analytics.eventpayload.search.md) | | { searchId?: string; queryId?: string; verticalKey?: string; isDirectAnswer?: boolean; versionLabel?: [VersionLabel](./analytics.versionlabel.md); versionNumber?: number; experienceKey: string; } | _(Optional)_ Fields specific to reporting Yext Search Analytics Events | | [searchTerm?](./analytics.eventpayload.searchterm.md) | | string | _(Optional)_ | | [sessionId?](./analytics.eventpayload.sessionid.md) | | string \| null | _(Optional)_ Unique identifier to tie together events in a single browsing session | -| [timestamp?](./analytics.eventpayload.timestamp.md) | | Date \| string | _(Optional)_ The timestamp at which the event occurred, in ISO format. | +| [timestamp?](./analytics.eventpayload.timestamp.md) | | Date \| string |

_(Optional)_ The timestamp at which the event occurred, in ISO format.

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

| | [value?](./analytics.eventpayload.value.md) | | { amount: number; currency: string; } | _(Optional)_ The monetary value of the event. | | [visitor?](./analytics.eventpayload.visitor.md) | | Record<string, string> | _(Optional)_ Information used to associate analytics with a particular user. | diff --git a/docs/analytics.eventpayload.pageurl.md b/docs/analytics.eventpayload.pageurl.md index 9ace164..7e8a7a5 100644 --- a/docs/analytics.eventpayload.pageurl.md +++ b/docs/analytics.eventpayload.pageurl.md @@ -4,7 +4,9 @@ ## EventPayload.pageUrl property -The URL of the page where the event occurred +The URL of the page where the event occurred. + +If not specified the system will automatically use the `Referer` header of the request. **Signature:** diff --git a/docs/analytics.eventpayload.referrerurl.md b/docs/analytics.eventpayload.referrerurl.md index 67ed268..3355d65 100644 --- a/docs/analytics.eventpayload.referrerurl.md +++ b/docs/analytics.eventpayload.referrerurl.md @@ -6,6 +6,8 @@ The URL of the page which the visitor came from prior to the event. +If not specified the system will automatically use the `Referer` header of the request. + **Signature:** ```typescript diff --git a/docs/analytics.eventpayload.timestamp.md b/docs/analytics.eventpayload.timestamp.md index fee6e99..15890cd 100644 --- a/docs/analytics.eventpayload.timestamp.md +++ b/docs/analytics.eventpayload.timestamp.md @@ -6,6 +6,8 @@ The timestamp at which the event occurred, in ISO format. +If not specified the system will automatically use the time when the request was received as the event timestamp. + **Signature:** ```typescript diff --git a/src/EventPayload.ts b/src/EventPayload.ts index 2945bd5..f083129 100644 --- a/src/EventPayload.ts +++ b/src/EventPayload.ts @@ -12,9 +12,17 @@ export interface EventPayload { action?: Action; /** The authorization token for the request. This will be setup from the Key or Bearer in the config. */ authorization?: string; - /** Whether the event is the result of bot activity. */ + /** Whether the event is the result of bot activity. + * + * If not specified the system will automatically detect whether + * this event originates from a bot. + */ bot?: boolean; - /** Information about the visitors device and browser. */ + /** Information about the visitors device and browser. + * + * If not specified the system will automatically detect + * the values from request headers or `userAgent` property. + */ browserAgent?: { /** The browser associated with the event. */ browser?: string; @@ -71,22 +79,52 @@ export interface EventPayload { internalUser?: boolean; /** The IP address for the event.*/ ip?: { - /** The IPv4 address associated with the event. */ + /** The IPv4 address associated with the event. + * + * If not specified the system will use the Source IP address + * from the IP header of the request. + */ address: string; /** The algorithm to use to anonymize the IP address after collection. */ algorithm: string; }; /** A label assigned to the event, e.g. a CTA label. */ label?: string; - /** The locale of the user who generated the event. */ + /** The locale of the user who generated the event. + * + * If not specified the system will automatically + * determine the locale from the Accept-Language header. + */ locale?: string; /** 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. */ + * with the country of the visitor for the event, as a ISO 3166-1 alpha-2 country code. + * + * 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. + */ location?: Coordinates | string; - /** The URL of the page where the event occurred */ + /** Fields specific to reporting Yext Pages Analytics Events */ + pages?: { + /** The scope of an action. Applies to Pages events. */ + scope?: string; + /* The UID of the site an event was tied to. */ + siteUid?: number; + /* The ID of the template from which a site was generated. */ + template?: string; + }; + /** The URL of the page where the event occurred. + * + * If not specified the system will automatically + * use the `Referrer` header from the auto-generated request headers. + */ pageUrl?: string; - /** The URL of the page which the visitor came from prior to the event. */ + /** The URL of the page which the visitor came from prior to the event. + * + * If not specified the system will automatically + * use the `Referrer` header from the auto-generated request headers. + */ referrerUrl?: string; /** Fields specific to reporting Yext Search Analytics Events */ search?: { @@ -109,22 +147,21 @@ export interface EventPayload { searchTerm?: string; /** Unique identifier to tie together events in a single browsing session */ sessionId?: string | null; - /** Fields specific to reporting Yext Pages Analytics Events */ - pages?: { - /** The scope of an action. Applies to Pages events. */ - scope?: string; - /* The UID of the site an event was tied to. */ - siteUid?: number; - /* The ID of the template from which a site was generated. */ - template?: string; - }; - /** The timestamp at which the event occurred, in ISO format. */ + /** 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. + * + * If not specified the system will automatically + * use the time when the request was received as the event timestamp. + */ timestamp?: Date | string; /** The monetary value of the event. */ value?: { /** The monetary value. */ amount: number; - /** The ISO 4217 currency code of the currency the value is expressed in. */ + /** The ISO 4217 currency code of the currency the value is expressed in. + * For example, "USD" for US dollars. + */ currency: string; }; /**