Parameters
- batches: {
events: (
| {
channel: "mobile"
| "server"
| "web";
componentId: string;
componentType: "Entry" | "Variable";
context: {
app?: { name: string; version: string };
campaign: {
content?: string;
medium?: string;
name?: string;
source?: string;
term?: string;
};
gdpr: { isConsentGiven: boolean };
library: { name: string; version: string };
locale: string;
location?: {
city?: string;
continent?: string;
coordinates?: { latitude: number; longitude: number };
country?: string;
countryCode?: string;
postalCode?: string;
region?: string;
regionCode?: string;
timezone?: string;
};
page?: {
path: string;
query: Record<string, string>;
referrer: string;
search: string;
title?: string;
url: string;
[key: string]: JSONType;
};
screen?: { name: string; [key: string]: JSONType };
userAgent?: string;
};
experienceId?: string;
messageId: string;
originalTimestamp: string;
sentAt: string;
timestamp: string;
type: "component";
userId?: string;
variantIndex: number;
viewDurationMs?: number;
viewId?: string;
}
| {
channel: "mobile"
| "server"
| "web";
componentId: string;
componentType: "Entry" | "Variable";
context: {
app?: { name: string; version: string };
campaign: {
content?: string;
medium?: string;
name?: string;
source?: string;
term?: string;
};
gdpr: { isConsentGiven: boolean };
library: { name: string; version: string };
locale: string;
location?: {
city?: string;
continent?: string;
coordinates?: { latitude: number; longitude: number };
country?: string;
countryCode?: string;
postalCode?: string;
region?: string;
regionCode?: string;
timezone?: string;
};
page?: {
path: string;
query: Record<string, string>;
referrer: string;
search: string;
title?: string;
url: string;
[key: string]: JSONType;
};
screen?: { name: string; [key: string]: JSONType };
userAgent?: string;
};
experienceId?: string;
messageId: string;
originalTimestamp: string;
sentAt: string;
timestamp: string;
type: "component_click";
userId?: string;
variantIndex: number;
}
| {
channel: "mobile"
| "server"
| "web";
componentId: string;
componentType: "Entry" | "Variable";
context: {
app?: { name: string; version: string };
campaign: {
content?: string;
medium?: string;
name?: string;
source?: string;
term?: string;
};
gdpr: { isConsentGiven: boolean };
library: { name: string; version: string };
locale: string;
location?: {
city?: string;
continent?: string;
coordinates?: { latitude: number; longitude: number };
country?: string;
countryCode?: string;
postalCode?: string;
region?: string;
regionCode?: string;
timezone?: string;
};
page?: {
path: string;
query: Record<string, string>;
referrer: string;
search: string;
title?: string;
url: string;
[key: string]: JSONType;
};
screen?: { name: string; [key: string]: JSONType };
userAgent?: string;
};
experienceId?: string;
hoverDurationMs: number;
hoverId: string;
messageId: string;
originalTimestamp: string;
sentAt: string;
timestamp: string;
type: "component_hover";
userId?: string;
variantIndex: number;
}
)[];
profile: { id: string; [key: string]: JSONType };
}[]events: (
| {
channel: "mobile"
| "server"
| "web";
componentId: string;
componentType: "Entry" | "Variable";
context: {
app?: { name: string; version: string };
campaign: {
content?: string;
medium?: string;
name?: string;
source?: string;
term?: string;
};
gdpr: { isConsentGiven: boolean };
library: { name: string; version: string };
locale: string;
location?: {
city?: string;
continent?: string;
coordinates?: { latitude: number; longitude: number };
country?: string;
countryCode?: string;
postalCode?: string;
region?: string;
regionCode?: string;
timezone?: string;
};
page?: {
path: string;
query: Record<string, string>;
referrer: string;
search: string;
title?: string;
url: string;
[key: string]: JSONType;
};
screen?: { name: string; [key: string]: JSONType };
userAgent?: string;
};
experienceId?: string;
messageId: string;
originalTimestamp: string;
sentAt: string;
timestamp: string;
type: "component";
userId?: string;
variantIndex: number;
viewDurationMs?: number;
viewId?: string;
}
| {
channel: "mobile"
| "server"
| "web";
componentId: string;
componentType: "Entry" | "Variable";
context: {
app?: { name: string; version: string };
campaign: {
content?: string;
medium?: string;
name?: string;
source?: string;
term?: string;
};
gdpr: { isConsentGiven: boolean };
library: { name: string; version: string };
locale: string;
location?: {
city?: string;
continent?: string;
coordinates?: { latitude: number; longitude: number };
country?: string;
countryCode?: string;
postalCode?: string;
region?: string;
regionCode?: string;
timezone?: string;
};
page?: {
path: string;
query: Record<string, string>;
referrer: string;
search: string;
title?: string;
url: string;
[key: string]: JSONType;
};
screen?: { name: string; [key: string]: JSONType };
userAgent?: string;
};
experienceId?: string;
messageId: string;
originalTimestamp: string;
sentAt: string;
timestamp: string;
type: "component_click";
userId?: string;
variantIndex: number;
}
| {
channel: "mobile"
| "server"
| "web";
componentId: string;
componentType: "Entry" | "Variable";
context: {
app?: { name: string; version: string };
campaign: {
content?: string;
medium?: string;
name?: string;
source?: string;
term?: string;
};
gdpr: { isConsentGiven: boolean };
library: { name: string; version: string };
locale: string;
location?: {
city?: string;
continent?: string;
coordinates?: { latitude: number; longitude: number };
country?: string;
countryCode?: string;
postalCode?: string;
region?: string;
regionCode?: string;
timezone?: string;
};
page?: {
path: string;
query: Record<string, string>;
referrer: string;
search: string;
title?: string;
url: string;
[key: string]: JSONType;
};
screen?: { name: string; [key: string]: JSONType };
userAgent?: string;
};
experienceId?: string;
hoverDurationMs: number;
hoverId: string;
messageId: string;
originalTimestamp: string;
sentAt: string;
timestamp: string;
type: "component_hover";
userId?: string;
variantIndex: number;
}
)[]
profile: { id: string; [key: string]: JSONType }
- options: InsightsApiClientRequestOptions = {}
Returns Promise<boolean>
true when the event batch is successfully queued by the beacon
handler or a direct request is successfully sent, false otherwise.
Client for sending analytics and insights events to the Ninetailed Insights API.
Remarks
This client is optimized for sending batched events, optionally using a custom beacon-like handler when available.
Example
Extends
ApiClientBase.