diff --git a/docs/analytics.eventpayload.md b/docs/analytics.eventpayload.md index 7b5bb3ff..abee73c3 100644 --- a/docs/analytics.eventpayload.md +++ b/docs/analytics.eventpayload.md @@ -32,12 +32,12 @@ export interface EventPayload | [label?](./analytics.eventpayload.label.md) | | string | _(Optional)_ A label assigned to the event, e.g. a CTA label. | | [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) | | { 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. | | [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 | -| [sites?](./analytics.eventpayload.sites.md) | | { siteUid?: number; template?: string; } | _(Optional)_ Fields specific to reporting Yext Pages Analytics Events | | [timestamp?](./analytics.eventpayload.timestamp.md) | | Date \| string | _(Optional)_ The timestamp at which the event occurred, in ISO format. | | [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.sites.md b/docs/analytics.eventpayload.pages.md similarity index 66% rename from docs/analytics.eventpayload.sites.md rename to docs/analytics.eventpayload.pages.md index 6dec1af3..9dc63541 100644 --- a/docs/analytics.eventpayload.sites.md +++ b/docs/analytics.eventpayload.pages.md @@ -1,15 +1,15 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> -[Home](./index.md) > [@yext/analytics](./analytics.md) > [EventPayload](./analytics.eventpayload.md) > [sites](./analytics.eventpayload.sites.md) +[Home](./index.md) > [@yext/analytics](./analytics.md) > [EventPayload](./analytics.eventpayload.md) > [pages](./analytics.eventpayload.pages.md) -## EventPayload.sites property +## EventPayload.pages property Fields specific to reporting Yext Pages Analytics Events **Signature:** ```typescript -sites?: { +pages?: { siteUid?: number; template?: string; }; diff --git a/etc/analytics.api.md b/etc/analytics.api.md index 95dd4d58..dd210080 100644 --- a/etc/analytics.api.md +++ b/etc/analytics.api.md @@ -73,6 +73,10 @@ export interface EventPayload { locale?: string; // Warning: (ae-forgotten-export) The symbol "Coordinates" needs to be exported by the entry point index.d.ts location?: Coordinates | string; + pages?: { + siteUid?: number; + template?: string; + }; pageUrl?: string; referrerUrl?: string; search?: { @@ -87,10 +91,6 @@ export interface EventPayload { // (undocumented) searchTerm?: string; sessionId?: string | null; - sites?: { - siteUid?: number; - template?: string; - }; timestamp?: Date | string; value?: { amount: number; diff --git a/src/EventPayload.ts b/src/EventPayload.ts index b4638331..c0199481 100644 --- a/src/EventPayload.ts +++ b/src/EventPayload.ts @@ -110,7 +110,7 @@ export interface EventPayload { /** Unique identifier to tie together events in a single browsing session */ sessionId?: string | null; /** Fields specific to reporting Yext Pages Analytics Events */ - sites?: { + pages?: { /* The UID of the site an event was tied to. */ siteUid?: number; /* The ID of the template from which a site was generated. */ diff --git a/test-cdn/index.html b/test-cdn/index.html index 457a3532..3b9087b1 100644 --- a/test-cdn/index.html +++ b/test-cdn/index.html @@ -132,7 +132,7 @@ analyticsProvider.report({ action: 'WEBSITE', chat: null, - sites: { + pages: { siteUid: 123456789, template: 'test-template' } diff --git a/test-site/src/index.ts b/test-site/src/index.ts index 5cf7031c..89d72f6d 100644 --- a/test-site/src/index.ts +++ b/test-site/src/index.ts @@ -121,7 +121,7 @@ export function firePagesEvent() { analyticsProvider.report({ action: 'WEBSITE', chat: null, - sites: { + pages: { siteUid: 123456789, template: 'test-template' } diff --git a/tests/convertStringToValue.test.ts b/tests/convertStringToValue.test.ts index c3d65332..cabdad4f 100644 --- a/tests/convertStringToValue.test.ts +++ b/tests/convertStringToValue.test.ts @@ -8,7 +8,7 @@ describe('convertTypesGTM Test', () => { search: { versionNumber: '5' }, - sites: { + pages: { siteUid: '5' } }; @@ -21,7 +21,7 @@ describe('convertTypesGTM Test', () => { search: { versionNumber: 5 }, - sites: { + pages: { siteUid: 5 } });