From 8650c761f8703ff7c972b46a28a61fdae1facf27 Mon Sep 17 00:00:00 2001
From: Ethan Jaffee <ejaffee@yext.com>
Date: Wed, 25 Oct 2023 16:57:30 -0400
Subject: [PATCH 01/10] EventsSDK: Add Value property to EventPayload

---
 src/EventPayload.ts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/EventPayload.ts b/src/EventPayload.ts
index c0618ee3..e85a848e 100644
--- a/src/EventPayload.ts
+++ b/src/EventPayload.ts
@@ -112,6 +112,13 @@ export interface EventPayload {
     /** The algorithm to use to anonymize the IP address after collection. */
     algorithm?: 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. */
+    currency: string;
+  };
   /**
    * Information used to associate analytics with a particular user.
    *

From 8283a9cb63b3273d23fc81032879bca6b3208862 Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 25 Oct 2023 20:59:53 +0000
Subject: [PATCH 02/10] Automated update to repo's documentation from github
 action

---
 docs/analytics.eventpayload.md       |  1 +
 docs/analytics.eventpayload.value.md | 16 ++++++++++++++++
 etc/analytics.api.md                 |  4 ++++
 3 files changed, 21 insertions(+)
 create mode 100644 docs/analytics.eventpayload.value.md

diff --git a/docs/analytics.eventpayload.md b/docs/analytics.eventpayload.md
index 316fd72d..74ecb9e1 100644
--- a/docs/analytics.eventpayload.md
+++ b/docs/analytics.eventpayload.md
@@ -37,5 +37,6 @@ export interface EventPayload
 |  [sessionId?](./analytics.eventpayload.sessionid.md) | string \| null | <i>(Optional)</i> Unique identifier to tie together events in a single browsing session |
 |  [sites?](./analytics.eventpayload.sites.md) | { siteUid?: number; template?: string; } | <i>(Optional)</i> Fields specific to reporting Yext Pages Analytics Events |
 |  [timestamp?](./analytics.eventpayload.timestamp.md) | Date \| string | <i>(Optional)</i> The timestamp at which the event occurred, in ISO format. |
+|  [value?](./analytics.eventpayload.value.md) | { amount: number; currency: string; } | <i>(Optional)</i> The monetary value of the event. |
 |  [visitor?](./analytics.eventpayload.visitor.md) | Record&lt;string, string&gt; | <i>(Optional)</i> Information used to associate analytics with a particular user. |
 
diff --git a/docs/analytics.eventpayload.value.md b/docs/analytics.eventpayload.value.md
new file mode 100644
index 00000000..4cce50bf
--- /dev/null
+++ b/docs/analytics.eventpayload.value.md
@@ -0,0 +1,16 @@
+<!-- Do not edit this file. It is automatically generated by API Documenter. -->
+
+[Home](./index.md) &gt; [@yext/analytics](./analytics.md) &gt; [EventPayload](./analytics.eventpayload.md) &gt; [value](./analytics.eventpayload.value.md)
+
+## EventPayload.value property
+
+The monetary value of the event.
+
+<b>Signature:</b>
+
+```typescript
+value?: {
+        amount: number;
+        currency: string;
+    };
+```
diff --git a/etc/analytics.api.md b/etc/analytics.api.md
index 477504cd..ce2fd05a 100644
--- a/etc/analytics.api.md
+++ b/etc/analytics.api.md
@@ -88,6 +88,10 @@ export interface EventPayload {
         template?: string;
     };
     timestamp?: Date | string;
+    value?: {
+        amount: number;
+        currency: string;
+    };
     visitor?: Record<string, string>;
 }
 

From d9da6c3d9866f254e28523e9fbcce579606b6dda Mon Sep 17 00:00:00 2001
From: Ethan Jaffee <ejaffee@yext.com>
Date: Mon, 6 Nov 2023 14:07:38 -0500
Subject: [PATCH 03/10] add more missing props, make alphabetical

---
 src/Coordinates.ts  |   4 ++
 src/EventPayload.ts | 111 ++++++++++++++++++++++++--------------------
 2 files changed, 64 insertions(+), 51 deletions(-)
 create mode 100644 src/Coordinates.ts

diff --git a/src/Coordinates.ts b/src/Coordinates.ts
new file mode 100644
index 00000000..e08f6188
--- /dev/null
+++ b/src/Coordinates.ts
@@ -0,0 +1,4 @@
+export type Coordinates = {
+  latitude: number;
+  longitude: number;
+};
diff --git a/src/EventPayload.ts b/src/EventPayload.ts
index e85a848e..49342973 100644
--- a/src/EventPayload.ts
+++ b/src/EventPayload.ts
@@ -1,4 +1,5 @@
 import { Action } from './Action';
+import { Coordinates } from './Coordinates';
 import { VersionLabel } from './VersionLabel';
 
 /**
@@ -11,20 +12,6 @@ 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;
-  /** Unique identifier to tie together events in a single browsing session */
-  sessionId?: string | null;
-  /** The URL of the page where the event occurred */
-  pageUrl?: string;
-  /** The URL of the page the event is directing the visitor to. */
-  destinationUrl?: string;
-  /** The URL of the page which the visitor came from prior to the event. */
-  referrerUrl?: string;
-  /** A label assigned to the event, e.g. a CTA label. */
-  label?: string;
-  /** The locale of the user who generated the event. */
-  locale?: string;
-  /** The timestamp at which the event occurred, in ISO format. */
-  timestamp?: Date | string;
   /** Whether the event is the result of bot activity. */
   bot?: boolean;
   /** Information about the visitors device and browser. */
@@ -33,24 +20,17 @@ export interface EventPayload {
     browser?: string;
     /** The browser version associated with the event. */
     browserVersion?: string;
-    /** The operating system associated with the event. */
-    os?: string;
-    /** The operating system version associated with the event. */
-    osVersion?: string;
     /** The device associated with the event. */
     device?: string;
     /** The device class associated with the event. */
     deviceClass?: string;
+    /** The operating system associated with the event. */
+    os?: string;
+    /** The operating system version associated with the event. */
+    osVersion?: string;
     /** The user agent associated with the event. */
     userAgent?: string;
   };
-  /**
-   * 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.
-   */
-  clientSdk?: Record<string, string>;
-  /** Indicates whether the event is the result of internal activity. */
-  internalUser?: boolean;
   /** Fields specific to reporting Chat Analytics Events */
   chat?: {
     /** The ID of the bot that generated the event. */
@@ -60,31 +40,11 @@ export interface EventPayload {
     /** The ID of the individual response in which the event occurred. */
     responseId?: string;
   };
-  /** Fields specific to reporting Yext Search Analytics Events */
-  search?: {
-    /** Unique identifier of the search */
-    searchId?: string;
-    /** Unique identifier for a single query across pagination */
-    queryId?: string;
-    /** The vertical key on which the event occurred, if any */
-    verticalKey?: string;
-    /** Whether or not the event occurred on a direct answer card */
-    isDirectAnswer?: boolean;
-    /** The label of the version number of the search config.
-     * Either "PRODUCTION" or "STAGING" */
-    versionLabel?: VersionLabel;
-    /** The version number of the search config */
-    versionNumber?: number;
-    /** The identifier of the search experience. */
-    experienceKey: string;
-  };
-  /** Fields specific to reporting Yext Pages Analytics Events */
-  sites?: {
-    /* 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;
-  };
+  /**
+   * 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.
+   */
+  clientSdk?: Record<string, string>;
   /**
    * 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.
@@ -100,18 +60,67 @@ export interface EventPayload {
    * Keys are case-insensitive.
    */
   customValues?: Record<string, number>;
+  /** The URL of the page the event is directing the visitor to. */
+  destinationUrl?: string;
   /** 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.
    */
   entity?: string | number;
+  /** Indicates whether the event is the result of internal activity. */
+  internalUser?: boolean;
   /** The IP address for the event.*/
   ip?: {
     /** The IPv4 address associated with the event. */
     address: string;
     /** The algorithm to use to anonymize the IP address after collection. */
-    algorithm?: string;
+    algorithm: string;
+  };
+  /** A label assigned to the event, e.g. a CTA label. */
+  label?: string;
+  /** The locale of the user who generated the event. */
+  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. */
+  location?: Coordinates | string;
+  /* Deduplication ID for the event.
+  Events from the same app for the same business with the same nonce will get de-duplicated. */
+  nonce?: string;
+  /** The URL of the page where the event occurred */
+  pageUrl?: string;
+  /** The URL of the page which the visitor came from prior to the event. */
+  referrerUrl?: string;
+  /** Fields specific to reporting Yext Search Analytics Events */
+  search?: {
+    /** Unique identifier of the search */
+    searchId?: string;
+    /** Unique identifier for a single query across pagination */
+    queryId?: string;
+    /** The vertical key on which the event occurred, if any */
+    verticalKey?: string;
+    /** Whether or not the event occurred on a direct answer card */
+    isDirectAnswer?: boolean;
+    /** The label of the version number of the search config. Either "PRODUCTION" or "STAGING" */
+    versionLabel?: VersionLabel;
+    /** The version number of the search config */
+    versionNumber?: number;
+    /** The identifier of the search experience. */
+    experienceKey: string;
+  };
+  /* The query entered by the user. */
+  searchTerm?: string;
+  /** Unique identifier to tie together events in a single browsing session */
+  sessionId?: string | null;
+  /** Fields specific to reporting Yext Pages Analytics Events */
+  sites?: {
+    /* 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. */
+  timestamp?: Date | string;
   /** The monetary value of the event. */
   value?: {
     /** The monetary value. */

From ed3923a6310f6ef849ffa1751faacb87920db488 Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Mon, 6 Nov 2023 19:08:38 +0000
Subject: [PATCH 04/10] Automated update to repo's documentation from github
 action

---
 docs/analytics.eventpayload.browseragent.md |  4 ++--
 docs/analytics.eventpayload.ip.md           |  2 +-
 docs/analytics.eventpayload.location.md     | 13 +++++++++++++
 docs/analytics.eventpayload.md              |  7 +++++--
 docs/analytics.eventpayload.nonce.md        | 11 +++++++++++
 docs/analytics.eventpayload.searchterm.md   | 11 +++++++++++
 etc/analytics.api.md                        | 12 +++++++++---
 7 files changed, 52 insertions(+), 8 deletions(-)
 create mode 100644 docs/analytics.eventpayload.location.md
 create mode 100644 docs/analytics.eventpayload.nonce.md
 create mode 100644 docs/analytics.eventpayload.searchterm.md

diff --git a/docs/analytics.eventpayload.browseragent.md b/docs/analytics.eventpayload.browseragent.md
index 5380c846..e424fdbd 100644
--- a/docs/analytics.eventpayload.browseragent.md
+++ b/docs/analytics.eventpayload.browseragent.md
@@ -12,10 +12,10 @@ Information about the visitors device and browser.
 browserAgent?: {
         browser?: string;
         browserVersion?: string;
-        os?: string;
-        osVersion?: string;
         device?: string;
         deviceClass?: string;
+        os?: string;
+        osVersion?: string;
         userAgent?: string;
     };
 ```
diff --git a/docs/analytics.eventpayload.ip.md b/docs/analytics.eventpayload.ip.md
index 7e6117da..d92381ab 100644
--- a/docs/analytics.eventpayload.ip.md
+++ b/docs/analytics.eventpayload.ip.md
@@ -11,6 +11,6 @@ The IP address for the event.
 ```typescript
 ip?: {
         address: string;
-        algorithm?: string;
+        algorithm: string;
     };
 ```
diff --git a/docs/analytics.eventpayload.location.md b/docs/analytics.eventpayload.location.md
new file mode 100644
index 00000000..751452be
--- /dev/null
+++ b/docs/analytics.eventpayload.location.md
@@ -0,0 +1,13 @@
+<!-- Do not edit this file. It is automatically generated by API Documenter. -->
+
+[Home](./index.md) &gt; [@yext/analytics](./analytics.md) &gt; [EventPayload](./analytics.eventpayload.md) &gt; [location](./analytics.eventpayload.location.md)
+
+## EventPayload.location property
+
+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.
+
+<b>Signature:</b>
+
+```typescript
+location?: Coordinates | string;
+```
diff --git a/docs/analytics.eventpayload.md b/docs/analytics.eventpayload.md
index 74ecb9e1..97b8e07b 100644
--- a/docs/analytics.eventpayload.md
+++ b/docs/analytics.eventpayload.md
@@ -19,7 +19,7 @@ export interface EventPayload
 |  [action](./analytics.eventpayload.action.md) | [Action](./analytics.action.md) | The user action which caused the event, e.g. ADD\_TO\_CART, THUMBS\_UP, C\_CUSTOM\_ACTION |
 |  [authorization?](./analytics.eventpayload.authorization.md) | string | <i>(Optional)</i> The authorization token for the request. This will be setup from the Key or Bearer in the config. |
 |  [bot?](./analytics.eventpayload.bot.md) | boolean | <i>(Optional)</i> Whether the event is the result of bot activity. |
-|  [browserAgent?](./analytics.eventpayload.browseragent.md) | { browser?: string; browserVersion?: string; os?: string; osVersion?: string; device?: string; deviceClass?: string; userAgent?: string; } | <i>(Optional)</i> Information about the visitors device and browser. |
+|  [browserAgent?](./analytics.eventpayload.browseragent.md) | { browser?: string; browserVersion?: string; device?: string; deviceClass?: string; os?: string; osVersion?: string; userAgent?: string; } | <i>(Optional)</i> Information about the visitors device and browser. |
 |  [chat?](./analytics.eventpayload.chat.md) | { botId: string; conversationId?: string; responseId?: string; } | <i>(Optional)</i> Fields specific to reporting Chat Analytics Events |
 |  [clientSdk?](./analytics.eventpayload.clientsdk.md) | Record&lt;string, string&gt; | <i>(Optional)</i> 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 | <i>(Optional)</i> 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. |
@@ -28,12 +28,15 @@ export interface EventPayload
 |  [destinationUrl?](./analytics.eventpayload.destinationurl.md) | string | <i>(Optional)</i> The URL of the page the event is directing the visitor to. |
 |  [entity?](./analytics.eventpayload.entity.md) | string \| number | <i>(Optional)</i> 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?](./analytics.eventpayload.internaluser.md) | boolean | <i>(Optional)</i> Indicates whether the event is the result of internal activity. |
-|  [ip?](./analytics.eventpayload.ip.md) | { address: string; algorithm?: string; } | <i>(Optional)</i> The IP address for the event. |
+|  [ip?](./analytics.eventpayload.ip.md) | { address: string; algorithm: string; } | <i>(Optional)</i> The IP address for the event. |
 |  [label?](./analytics.eventpayload.label.md) | string | <i>(Optional)</i> A label assigned to the event, e.g. a CTA label. |
 |  [locale?](./analytics.eventpayload.locale.md) | string | <i>(Optional)</i> The locale of the user who generated the event. |
+|  [location?](./analytics.eventpayload.location.md) | Coordinates \| string | <i>(Optional)</i> 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. |
+|  [nonce?](./analytics.eventpayload.nonce.md) | string | <i>(Optional)</i> |
 |  [pageUrl?](./analytics.eventpayload.pageurl.md) | string | <i>(Optional)</i> The URL of the page where the event occurred |
 |  [referrerUrl?](./analytics.eventpayload.referrerurl.md) | string | <i>(Optional)</i> 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; } | <i>(Optional)</i> Fields specific to reporting Yext Search Analytics Events |
+|  [searchTerm?](./analytics.eventpayload.searchterm.md) | string | <i>(Optional)</i> |
 |  [sessionId?](./analytics.eventpayload.sessionid.md) | string \| null | <i>(Optional)</i> Unique identifier to tie together events in a single browsing session |
 |  [sites?](./analytics.eventpayload.sites.md) | { siteUid?: number; template?: string; } | <i>(Optional)</i> Fields specific to reporting Yext Pages Analytics Events |
 |  [timestamp?](./analytics.eventpayload.timestamp.md) | Date \| string | <i>(Optional)</i> The timestamp at which the event occurred, in ISO format. |
diff --git a/docs/analytics.eventpayload.nonce.md b/docs/analytics.eventpayload.nonce.md
new file mode 100644
index 00000000..99221d88
--- /dev/null
+++ b/docs/analytics.eventpayload.nonce.md
@@ -0,0 +1,11 @@
+<!-- Do not edit this file. It is automatically generated by API Documenter. -->
+
+[Home](./index.md) &gt; [@yext/analytics](./analytics.md) &gt; [EventPayload](./analytics.eventpayload.md) &gt; [nonce](./analytics.eventpayload.nonce.md)
+
+## EventPayload.nonce property
+
+<b>Signature:</b>
+
+```typescript
+nonce?: string;
+```
diff --git a/docs/analytics.eventpayload.searchterm.md b/docs/analytics.eventpayload.searchterm.md
new file mode 100644
index 00000000..f1d7e494
--- /dev/null
+++ b/docs/analytics.eventpayload.searchterm.md
@@ -0,0 +1,11 @@
+<!-- Do not edit this file. It is automatically generated by API Documenter. -->
+
+[Home](./index.md) &gt; [@yext/analytics](./analytics.md) &gt; [EventPayload](./analytics.eventpayload.md) &gt; [searchTerm](./analytics.eventpayload.searchterm.md)
+
+## EventPayload.searchTerm property
+
+<b>Signature:</b>
+
+```typescript
+searchTerm?: string;
+```
diff --git a/etc/analytics.api.md b/etc/analytics.api.md
index ce2fd05a..a15b0f1a 100644
--- a/etc/analytics.api.md
+++ b/etc/analytics.api.md
@@ -47,10 +47,10 @@ export interface EventPayload {
     browserAgent?: {
         browser?: string;
         browserVersion?: string;
-        os?: string;
-        osVersion?: string;
         device?: string;
         deviceClass?: string;
+        os?: string;
+        osVersion?: string;
         userAgent?: string;
     };
     chat?: {
@@ -67,10 +67,14 @@ export interface EventPayload {
     internalUser?: boolean;
     ip?: {
         address: string;
-        algorithm?: string;
+        algorithm: string;
     };
     label?: string;
     locale?: string;
+    // Warning: (ae-forgotten-export) The symbol "Coordinates" needs to be exported by the entry point index.d.ts
+    location?: Coordinates | string;
+    // (undocumented)
+    nonce?: string;
     pageUrl?: string;
     referrerUrl?: string;
     search?: {
@@ -82,6 +86,8 @@ export interface EventPayload {
         versionNumber?: number;
         experienceKey: string;
     };
+    // (undocumented)
+    searchTerm?: string;
     sessionId?: string | null;
     sites?: {
         siteUid?: number;

From 3d308753b7326ed07e2a687277f67b9426283d6c Mon Sep 17 00:00:00 2001
From: Ethan Jaffee <ejaffee@yext.com>
Date: Tue, 7 Nov 2023 15:37:14 -0500
Subject: [PATCH 05/10] add test with entire payload to
 AnalyticsEventReporter.test.ts

---
 src/Coordinates.ts                   |   6 +-
 tests/AnalyticsEventReporter.test.ts | 169 +++++++++++++++++++++++++++
 2 files changed, 173 insertions(+), 2 deletions(-)

diff --git a/src/Coordinates.ts b/src/Coordinates.ts
index e08f6188..c00f5e76 100644
--- a/src/Coordinates.ts
+++ b/src/Coordinates.ts
@@ -1,4 +1,6 @@
 export type Coordinates = {
-  latitude: number;
-  longitude: number;
+  coordinates: {
+    latitude: number;
+    longitude: number;
+  };
 };
diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts
index a5283040..c487c1d6 100644
--- a/tests/AnalyticsEventReporter.test.ts
+++ b/tests/AnalyticsEventReporter.test.ts
@@ -553,4 +553,173 @@ describe('Test report function', () => {
       }
     );
   });
+
+  it('should call post with correct fields - full payload', async () => {
+    mockPostWithBeacon.mockReturnValueOnce(true);
+    mockUseBeacon.mockReturnValueOnce(true);
+    const navigator = {
+      userAgent: 'Firefox',
+      sendBeacon: () => {
+        return true;
+      }
+    };
+    Object.defineProperty(window, 'navigator', {
+      value: navigator,
+      writable: true
+    });
+
+    const config: AnalyticsConfig = {
+      key: 'validKey',
+      region: RegionEnum.EU,
+      forceFetch: false,
+      sessionTrackingEnabled: true
+    };
+    const reporter = new AnalyticsEventReporter(config).with({
+      action: 'ADD_TO_CART',
+      bot: false,
+      browserAgent: {
+        browser: 'chrome',
+        browserVersion: '1.0.0',
+        device: 'desktop',
+        deviceClass: 'desktop',
+        os: 'windows',
+        osVersion: '10',
+        userAgent: 'chrome'
+      },
+      chat: {
+        botId: 'botId',
+        conversationId: 'conversationId',
+        responseId: 'responseId'
+      },
+      clientSdk: {
+        chat: '1.0.0'
+      },
+      count: 5,
+      customTags: {
+        customTag: 'customTagValue'
+      },
+      customValues: {
+        customValue: 1
+      },
+      destinationUrl: 'https://google.com',
+      entity: 'entityId',
+      internalUser: false,
+      ip: {
+        address: '1.0.0.0',
+        algorithm: 'HASH'
+      },
+      label: 'label',
+      locale: 'en_US',
+      location: {
+        coordinates: {
+          latitude: 1,
+          longitude: 1
+        }
+      },
+      nonce: 'nonce',
+      pageUrl: 'https://yext.com',
+      referrerUrl: 'https://yext.com',
+      search: {
+        versionNumber: 5,
+        isDirectAnswer: false,
+        experienceKey: 'experienceKey',
+        queryId: 'queryId'
+      },
+      searchTerm: 'searchTerm',
+      sessionId: 'sessionId',
+      sites: {
+        siteUid: 321,
+        template: 'template'
+      },
+      timestamp: new Date(12, 7),
+      value: {
+        amount: 1,
+        currency: 'USD'
+      },
+      visitor: {
+        'visitor-id': 'visitor-id'
+      }
+    });
+
+    const res = await reporter.report({
+      action: 'C_CUSTOM_ACTION',
+      destinationUrl: 'https://google.com'
+    });
+
+    // Expect true to be returned for beacon request
+    expect(res).toEqual('');
+    /** Expect merge to have completed correctly, the url to be constructed correctly,
+    and the clientSdk and authorization to be added to the request body in the correct format. **/
+    expect(mockPostWithBeacon).toHaveBeenCalledWith(
+      'https://eu.yextevents.com/accounts/me/events',
+      {
+        action: 'C_CUSTOM_ACTION',
+        authorization: 'KEY validKey',
+        bot: false,
+        browserAgent: {
+          browser: 'chrome',
+          browserVersion: '1.0.0',
+          device: 'desktop',
+          deviceClass: 'desktop',
+          os: 'windows',
+          osVersion: '10',
+          userAgent: 'chrome'
+        },
+        chat: {
+          botId: 'botId',
+          conversationId: 'conversationId',
+          responseId: 'responseId'
+        },
+        clientSdk: {
+          ANALYTICS: '1.0.0-beta.2',
+          chat: '1.0.0'
+        },
+        count: 5,
+        customTags: {
+          customTag: 'customTagValue'
+        },
+        customValues: {
+          customValue: 1
+        },
+        destinationUrl: 'https://google.com',
+        entity: 'entityId',
+        internalUser: false,
+        ip: {
+          address: '1.0.0.0',
+          algorithm: 'HASH'
+        },
+        label: 'label',
+        locale: 'en_US',
+        location: {
+          coordinates: {
+            latitude: 1,
+            longitude: 1
+          }
+        },
+        nonce: 'nonce',
+        pageUrl: 'https://yext.com',
+        referrerUrl: 'https://yext.com',
+        search: {
+          versionNumber: 5,
+          isDirectAnswer: false,
+          experienceKey: 'experienceKey',
+          queryId: 'queryId'
+        },
+        searchTerm: 'searchTerm',
+        sessionId: 'sessionId',
+        sites: {
+          siteUid: 321,
+          template: 'template'
+        },
+        timestamp: '1912-08-01T05:00:00.000Z',
+        value: {
+          amount: 1,
+          currency: 'USD'
+        },
+        visitor: {
+          'visitor-id': 'visitor-id'
+        }
+      }
+    );
+  });
 });

From 2124dd91e87e1af3126bf371bf346c8f5ead83d6 Mon Sep 17 00:00:00 2001
From: Ethan Jaffee <ejaffee@yext.com>
Date: Wed, 8 Nov 2023 11:19:37 -0500
Subject: [PATCH 06/10] fix test timestamp diff

---
 tests/AnalyticsEventReporter.test.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts
index c487c1d6..e1bccf9a 100644
--- a/tests/AnalyticsEventReporter.test.ts
+++ b/tests/AnalyticsEventReporter.test.ts
@@ -631,7 +631,7 @@ describe('Test report function', () => {
         siteUid: 321,
         template: 'template'
       },
-      timestamp: new Date(12, 7),
+      timestamp: '1912-08-01T05:00:00.000Z',
       value: {
         amount: 1,
         currency: 'USD'

From b9ee23f5df5b3db97c82171410a9f9567ae6f6b9 Mon Sep 17 00:00:00 2001
From: Ethan Jaffee <ejaffee@yext.com>
Date: Fri, 10 Nov 2023 15:47:58 -0500
Subject: [PATCH 07/10] remove nonce

---
 src/EventPayload.ts |  3 ---
 test-gtm/index.html | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 test-gtm/index.html

diff --git a/src/EventPayload.ts b/src/EventPayload.ts
index 49342973..d86fe8fb 100644
--- a/src/EventPayload.ts
+++ b/src/EventPayload.ts
@@ -84,9 +84,6 @@ export interface EventPayload {
    * 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. */
   location?: Coordinates | string;
-  /* Deduplication ID for the event.
-  Events from the same app for the same business with the same nonce will get de-duplicated. */
-  nonce?: string;
   /** The URL of the page where the event occurred */
   pageUrl?: string;
   /** The URL of the page which the visitor came from prior to the event. */
diff --git a/test-gtm/index.html b/test-gtm/index.html
new file mode 100644
index 00000000..7a2ac4df
--- /dev/null
+++ b/test-gtm/index.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <!-- Google Tag Manager -->
+    <script>
+      (function (w, d, s, l, i) {
+        w[l] = w[l] || [];
+        w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
+        var f = d.getElementsByTagName(s)[0],
+          j = d.createElement(s),
+          dl = l != 'dataLayer' ? '&l=' + l : '';
+        j.async = true;
+        j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
+        f.parentNode.insertBefore(j, f);
+      })(window, document, 'script', 'dataLayer', 'GTM-5XJN5FXJ');
+    </script>
+    <!-- End Google Tag Manager -->
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>Analytics Test</title>
+  </head>
+  <body>
+    <!-- Google Tag Manager (noscript) -->
+    <noscript
+      ><iframe
+        src="https://www.googletagmanager.com/ns.html?id=GTM-5XJN5FXJ"
+        height="0"
+        width="0"
+        style="display: none; visibility: hidden"
+      ></iframe
+    ></noscript>
+    <!-- End Google Tag Manager (noscript) -->
+    <h1>Analytics Test</h1>
+    <button type="button">Test</button>
+  </body>
+</html>

From 92a41f92eddaee0564228e1e98ef431d041515fd Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Fri, 10 Nov 2023 20:48:55 +0000
Subject: [PATCH 08/10] Automated update to repo's documentation from github
 action

---
 docs/analytics.eventpayload.md       |  1 -
 docs/analytics.eventpayload.nonce.md | 11 -----------
 etc/analytics.api.md                 |  2 --
 3 files changed, 14 deletions(-)
 delete mode 100644 docs/analytics.eventpayload.nonce.md

diff --git a/docs/analytics.eventpayload.md b/docs/analytics.eventpayload.md
index 97b8e07b..090e446e 100644
--- a/docs/analytics.eventpayload.md
+++ b/docs/analytics.eventpayload.md
@@ -32,7 +32,6 @@ export interface EventPayload
 |  [label?](./analytics.eventpayload.label.md) | string | <i>(Optional)</i> A label assigned to the event, e.g. a CTA label. |
 |  [locale?](./analytics.eventpayload.locale.md) | string | <i>(Optional)</i> The locale of the user who generated the event. |
 |  [location?](./analytics.eventpayload.location.md) | Coordinates \| string | <i>(Optional)</i> 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. |
-|  [nonce?](./analytics.eventpayload.nonce.md) | string | <i>(Optional)</i> |
 |  [pageUrl?](./analytics.eventpayload.pageurl.md) | string | <i>(Optional)</i> The URL of the page where the event occurred |
 |  [referrerUrl?](./analytics.eventpayload.referrerurl.md) | string | <i>(Optional)</i> 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; } | <i>(Optional)</i> Fields specific to reporting Yext Search Analytics Events |
diff --git a/docs/analytics.eventpayload.nonce.md b/docs/analytics.eventpayload.nonce.md
deleted file mode 100644
index 99221d88..00000000
--- a/docs/analytics.eventpayload.nonce.md
+++ /dev/null
@@ -1,11 +0,0 @@
-<!-- Do not edit this file. It is automatically generated by API Documenter. -->
-
-[Home](./index.md) &gt; [@yext/analytics](./analytics.md) &gt; [EventPayload](./analytics.eventpayload.md) &gt; [nonce](./analytics.eventpayload.nonce.md)
-
-## EventPayload.nonce property
-
-<b>Signature:</b>
-
-```typescript
-nonce?: string;
-```
diff --git a/etc/analytics.api.md b/etc/analytics.api.md
index a15b0f1a..c588b825 100644
--- a/etc/analytics.api.md
+++ b/etc/analytics.api.md
@@ -73,8 +73,6 @@ 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;
-    // (undocumented)
-    nonce?: string;
     pageUrl?: string;
     referrerUrl?: string;
     search?: {

From dfef3d814146ac80d5a1287e542924a29ba1eb47 Mon Sep 17 00:00:00 2001
From: Ethan Jaffee <ejaffee@yext.com>
Date: Fri, 10 Nov 2023 15:49:03 -0500
Subject: [PATCH 09/10] remove nonce from tests

---
 tests/AnalyticsEventReporter.test.ts | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts
index e1bccf9a..731749a3 100644
--- a/tests/AnalyticsEventReporter.test.ts
+++ b/tests/AnalyticsEventReporter.test.ts
@@ -616,7 +616,6 @@ describe('Test report function', () => {
           longitude: 1
         }
       },
-      nonce: 'nonce',
       pageUrl: 'https://yext.com',
       referrerUrl: 'https://yext.com',
       search: {
@@ -696,7 +695,6 @@ describe('Test report function', () => {
             longitude: 1
           }
         },
-        nonce: 'nonce',
         pageUrl: 'https://yext.com',
         referrerUrl: 'https://yext.com',
         search: {

From 3d11c43a9da16d4bf675cbd6a26abf743e116241 Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Tue, 14 Nov 2023 16:37:57 +0000
Subject: [PATCH 10/10] Automated update to repo's documentation from github
 action

---
 docs/analytics.eventpayload.location.md   |  2 +-
 docs/analytics.eventpayload.md            | 54 +++++++++++------------
 docs/analytics.eventpayload.searchterm.md |  2 +-
 docs/analytics.eventpayload.value.md      |  2 +-
 4 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/docs/analytics.eventpayload.location.md b/docs/analytics.eventpayload.location.md
index 751452be..4f4bf032 100644
--- a/docs/analytics.eventpayload.location.md
+++ b/docs/analytics.eventpayload.location.md
@@ -6,7 +6,7 @@
 
 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.
 
-<b>Signature:</b>
+**Signature:**
 
 ```typescript
 location?: Coordinates | string;
diff --git a/docs/analytics.eventpayload.md b/docs/analytics.eventpayload.md
index cc977676..25f57eeb 100644
--- a/docs/analytics.eventpayload.md
+++ b/docs/analytics.eventpayload.md
@@ -14,31 +14,31 @@ export interface EventPayload
 
 ## Properties
 
-|  Property | Type | Description |
-|  --- | --- | --- |
-|  [action](./analytics.eventpayload.action.md) | [Action](./analytics.action.md) | The user action which caused the event, e.g. ADD\_TO\_CART, THUMBS\_UP, C\_CUSTOM\_ACTION |
-|  [authorization?](./analytics.eventpayload.authorization.md) | string | <i>(Optional)</i> The authorization token for the request. This will be setup from the Key or Bearer in the config. |
-|  [bot?](./analytics.eventpayload.bot.md) | boolean | <i>(Optional)</i> 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; } | <i>(Optional)</i> Information about the visitors device and browser. |
-|  [chat?](./analytics.eventpayload.chat.md) | { botId: string; conversationId?: string; responseId?: string; } | <i>(Optional)</i> Fields specific to reporting Chat Analytics Events |
-|  [clientSdk?](./analytics.eventpayload.clientsdk.md) | Record&lt;string, string&gt; | <i>(Optional)</i> 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 | <i>(Optional)</i> 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?](./analytics.eventpayload.customtags.md) | Record&lt;string, string&gt; | <i>(Optional)</i> 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?](./analytics.eventpayload.customvalues.md) | Record&lt;string, number&gt; | <i>(Optional)</i> Up to 10 pairs matching custom string keys to number values to associate with the event. Keys are case-insensitive. |
-|  [destinationUrl?](./analytics.eventpayload.destinationurl.md) | string | <i>(Optional)</i> The URL of the page the event is directing the visitor to. |
-|  [entity?](./analytics.eventpayload.entity.md) | string \| number | <i>(Optional)</i> 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?](./analytics.eventpayload.internaluser.md) | boolean | <i>(Optional)</i> Indicates whether the event is the result of internal activity. |
-|  [ip?](./analytics.eventpayload.ip.md) | { address: string; algorithm: string; } | <i>(Optional)</i> The IP address for the event. |
-|  [label?](./analytics.eventpayload.label.md) | string | <i>(Optional)</i> A label assigned to the event, e.g. a CTA label. |
-|  [locale?](./analytics.eventpayload.locale.md) | string | <i>(Optional)</i> The locale of the user who generated the event. |
-|  [location?](./analytics.eventpayload.location.md) | Coordinates \| string | <i>(Optional)</i> 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. |
-|  [pageUrl?](./analytics.eventpayload.pageurl.md) | string | <i>(Optional)</i> The URL of the page where the event occurred |
-|  [referrerUrl?](./analytics.eventpayload.referrerurl.md) | string | <i>(Optional)</i> 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; } | <i>(Optional)</i> Fields specific to reporting Yext Search Analytics Events |
-|  [searchTerm?](./analytics.eventpayload.searchterm.md) | string | <i>(Optional)</i> |
-|  [sessionId?](./analytics.eventpayload.sessionid.md) | string \| null | <i>(Optional)</i> Unique identifier to tie together events in a single browsing session |
-|  [sites?](./analytics.eventpayload.sites.md) | { siteUid?: number; template?: string; } | <i>(Optional)</i> Fields specific to reporting Yext Pages Analytics Events |
-|  [timestamp?](./analytics.eventpayload.timestamp.md) | Date \| string | <i>(Optional)</i> The timestamp at which the event occurred, in ISO format. |
-|  [value?](./analytics.eventpayload.value.md) | { amount: number; currency: string; } | <i>(Optional)</i> The monetary value of the event. |
-|  [visitor?](./analytics.eventpayload.visitor.md) | Record&lt;string, string&gt; | <i>(Optional)</i> Information used to associate analytics with a particular user. |
+|  Property | Modifiers | Type | Description |
+|  --- | --- | --- | --- |
+|  [action](./analytics.eventpayload.action.md) |  | [Action](./analytics.action.md) | 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. |
+|  [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&lt;string, string&gt; | _(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. |
+|  [customTags?](./analytics.eventpayload.customtags.md) |  | Record&lt;string, string&gt; | _(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?](./analytics.eventpayload.customvalues.md) |  | Record&lt;string, number&gt; | _(Optional)_ Up to 10 pairs matching custom string keys to number values to associate with the event. Keys are case-insensitive. |
+|  [destinationUrl?](./analytics.eventpayload.destinationurl.md) |  | string | _(Optional)_ The URL of the page the event is directing the visitor to. |
+|  [entity?](./analytics.eventpayload.entity.md) |  | 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?](./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. |
+|  [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. |
+|  [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&lt;string, string&gt; | _(Optional)_ Information used to associate analytics with a particular user. |
 
diff --git a/docs/analytics.eventpayload.searchterm.md b/docs/analytics.eventpayload.searchterm.md
index f1d7e494..ca6a7444 100644
--- a/docs/analytics.eventpayload.searchterm.md
+++ b/docs/analytics.eventpayload.searchterm.md
@@ -4,7 +4,7 @@
 
 ## EventPayload.searchTerm property
 
-<b>Signature:</b>
+**Signature:**
 
 ```typescript
 searchTerm?: string;
diff --git a/docs/analytics.eventpayload.value.md b/docs/analytics.eventpayload.value.md
index 4cce50bf..6882f57c 100644
--- a/docs/analytics.eventpayload.value.md
+++ b/docs/analytics.eventpayload.value.md
@@ -6,7 +6,7 @@
 
 The monetary value of the event.
 
-<b>Signature:</b>
+**Signature:**
 
 ```typescript
 value?: {