Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventsSDK: Add missing properties to EventPayload & make alphabetical #117

Merged
merged 11 commits into from
Nov 14, 2023
4 changes: 2 additions & 2 deletions docs/analytics.eventpayload.browseragent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
```
2 changes: 1 addition & 1 deletion docs/analytics.eventpayload.ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ The IP address for the event.
```typescript
ip?: {
address: string;
algorithm?: string;
algorithm: string;
};
```
13 changes: 13 additions & 0 deletions docs/analytics.eventpayload.location.md
Original file line number Diff line number Diff line change
@@ -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;
```
8 changes: 6 additions & 2 deletions docs/analytics.eventpayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand All @@ -28,14 +28,18 @@ 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. |
| [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. |

11 changes: 11 additions & 0 deletions docs/analytics.eventpayload.nonce.md
Original file line number Diff line number Diff line change
@@ -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;
```
11 changes: 11 additions & 0 deletions docs/analytics.eventpayload.searchterm.md
Original file line number Diff line number Diff line change
@@ -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;
```
16 changes: 16 additions & 0 deletions docs/analytics.eventpayload.value.md
Original file line number Diff line number Diff line change
@@ -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;
};
```
16 changes: 13 additions & 3 deletions etc/analytics.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?: {
Expand All @@ -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?: {
Expand All @@ -82,12 +86,18 @@ export interface EventPayload {
versionNumber?: number;
experienceKey: string;
};
// (undocumented)
searchTerm?: string;
sessionId?: string | null;
sites?: {
siteUid?: number;
template?: string;
};
timestamp?: Date | string;
value?: {
amount: number;
currency: string;
};
visitor?: Record<string, string>;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Coordinates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type Coordinates = {
mtian725 marked this conversation as resolved.
Show resolved Hide resolved
latitude: number;
longitude: number;
};
118 changes: 67 additions & 51 deletions src/EventPayload.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Action } from './Action';
import { Coordinates } from './Coordinates';
import { VersionLabel } from './VersionLabel';

/**
Expand All @@ -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. */
Expand All @@ -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. */
Expand All @@ -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.
Expand All @@ -100,17 +60,73 @@ 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;
ejaffee01 marked this conversation as resolved.
Show resolved Hide resolved
/** 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?: {
mtian725 marked this conversation as resolved.
Show resolved Hide resolved
/** 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.
Expand Down