Skip to main content

node-tracker.api

API Report File for "@snowplow/node-tracker"

Do not edit this file. It is a report generated by API Extractor.


import { Agents } from 'got';
import { PromiseCookieJar } from 'got';
import { RequestError } from 'got';
import { RequiredRetryOptions } from 'got';
import { Response } from 'got';
import { ToughCookieJar } from 'got';

// @public
export interface AdClickEvent {
advertiserId?: string;
bannerId?: string;
campaignId?: string;
clickId?: string;
cost?: number;
costModel?: "cpa" | "cpc" | "cpm";
impressionId?: string;
targetUrl: string;
zoneId?: string;
}

// @public
export interface AdConversionEvent {
action?: string;
advertiserId?: string;
campaignId?: string;
category?: string;
conversionId?: string;
cost?: number;
costModel?: "cpa" | "cpc" | "cpm";
initialValue?: number;
property?: string;
}

// @public
export interface AddToCartEvent {
category?: string;
currency?: string;
name?: string;
quantity: number;
sku: string;
unitPrice?: number;
}

// @public
export interface AdImpressionEvent {
advertiserId?: string;
bannerId?: string;
campaignId?: string;
cost?: number;
costModel?: "cpa" | "cpc" | "cpm";
impressionId?: string;
targetUrl?: string;
zoneId?: string;
}

// @public
export function buildAdClick(event: AdClickEvent): PayloadBuilder;

// @public
export function buildAdConversion(event: AdConversionEvent): PayloadBuilder;

// @public
export function buildAddToCart(event: AddToCartEvent): PayloadBuilder;

// @public
export function buildAdImpression(event: AdImpressionEvent): PayloadBuilder;

// @public
export function buildConsentGranted(event: ConsentGrantedEvent): {
event: PayloadBuilder;
context: {
schema: string;
data: Record<string, unknown>;
}[];
};

// @public
export function buildConsentWithdrawn(event: ConsentWithdrawnEvent): {
event: PayloadBuilder;
context: {
schema: string;
data: Record<string, unknown>;
}[];
};

// @public
export function buildEcommerceTransaction(event: EcommerceTransactionEvent): PayloadBuilder;

// @public
export function buildEcommerceTransactionItem(event: EcommerceTransactionItemEvent): PayloadBuilder;

// @public
export function buildFormFocusOrChange(event: FormFocusOrChangeEvent): PayloadBuilder;

// @public
export function buildFormSubmission(event: FormSubmissionEvent): PayloadBuilder;

// @public
export function buildLinkClick(event: LinkClickEvent): PayloadBuilder;

// @public
export function buildPagePing(event: PagePingEvent): PayloadBuilder;

// @public
export function buildPageView(event: PageViewEvent): PayloadBuilder;

// @public
export function buildRemoveFromCart(event: RemoveFromCartEvent): PayloadBuilder;

// @public
export function buildScreenView(event: ScreenViewEvent): PayloadBuilder;

// @public
export function buildSelfDescribingEvent(event: SelfDescribingEvent): PayloadBuilder;

// @public
export function buildSiteSearch(event: SiteSearchEvent): PayloadBuilder;

// @public
export function buildSocialInteraction(event: SocialInteractionEvent): PayloadBuilder;

// @public
export function buildStructEvent(event: StructuredEvent): PayloadBuilder;

// @public
export interface ConsentGrantedEvent {
description?: string;
expiry?: string;
id: string;
name?: string;
version: string;
}

// @public
export interface ConsentWithdrawnEvent {
all: boolean;
description?: string;
id?: string;
name?: string;
version?: string;
}

// @public
export interface ContextEvent {
event: Payload;
eventSchema: string;
eventType: string;
}

// @public
export type ContextFilter = (args?: ContextEvent) => boolean;

// @public
export type ContextGenerator = (args?: ContextEvent) => SelfDescribingJson | SelfDescribingJson[] | undefined;

// @public
export interface CoreConfiguration {
/* Should payloads be base64 encoded when built */
// (undocumented)
base64?: boolean;
/* A list of all the plugins to include at load */
// (undocumented)
callback?: (PayloadData: PayloadBuilder) => void;
/* A list of all the plugins to include at load */
// (undocumented)
corePlugins?: Array<CorePlugin>;
}

// @public
export interface CorePlugin {
// Warning: (ae-forgotten-export) The symbol "TrackerCore" needs to be exported by the entry point index.module.d.ts
activateCorePlugin?: (core: TrackerCore) => void;
afterTrack?: (payload: Payload) => void;
beforeTrack?: (payloadBuilder: PayloadBuilder) => void;
contexts?: () => SelfDescribingJson[];
// Warning: (ae-forgotten-export) The symbol "Logger" needs to be exported by the entry point index.module.d.ts
logger?: (logger: Logger) => void;
}

// @public
export interface EcommerceTransactionEvent {
affiliation?: string;
city?: string;
country?: string;
currency?: string;
orderId: string;
shipping?: number;
state?: string;
tax?: number;
total: number;
}

// @public
export interface EcommerceTransactionItemEvent {
category?: string;
currency?: string;
name?: string;
orderId: string;
price: number;
quantity?: number;
sku: string;
}

// @public (undocumented)
export interface Emitter {
// (undocumented)
flush: () => void;
// (undocumented)
input: (payload: Payload) => void;
}

// @public
export interface FormFocusOrChangeEvent {
elementClasses?: Array<string> | null;
elementId: string;
formId: string;
nodeName: string;
schema: "change_form" | "focus_form";
type?: string | null;
value: string | null;
}

// @public
export interface FormSubmissionEvent {
// Warning: (ae-forgotten-export) The symbol "FormElement" needs to be exported by the entry point index.module.d.ts
elements?: Array<FormElement>;
formClasses?: Array<string>;
formId: string;
}

// @public
export function gotEmitter(endpoint: string, protocol?: HttpProtocol, port?: number, method?: HttpMethod, bufferSize?: number, retry?: number | Partial<RequiredRetryOptions>, cookieJar?: PromiseCookieJar | ToughCookieJar, callback?: (error?: RequestError, response?: Response<string>) => void, agents?: Agents): Emitter;

// @public (undocumented)
export enum HttpMethod {
// (undocumented)
GET = "get",
// (undocumented)
POST = "post"
}

// @public (undocumented)
export enum HttpProtocol {
// (undocumented)
HTTP = "http",
// (undocumented)
HTTPS = "https"
}

// @public
export interface LinkClickEvent {
elementClasses?: Array<string>;
elementContent?: string;
elementId?: string;
elementTarget?: string;
targetUrl: string;
}

// @public
export interface PagePingEvent extends PageViewEvent {
maxXOffset?: number;
maxYOffset?: number;
minXOffset?: number;
minYOffset?: number;
}

// @public
export interface PageViewEvent {
pageTitle?: string | null;
pageUrl?: string | null;
referrer?: string | null;
}

// @public
export type Payload = Record<string, unknown>;

// @public
export interface PayloadBuilder {
add: (key: string, value: unknown) => void;
addContextEntity: (entity: SelfDescribingJson) => void;
addDict: (dict: Payload) => void;
addJson: (keyIfEncoded: string, keyIfNotEncoded: string, json: Record<string, unknown>) => void;
build: () => Payload;
// Warning: (ae-forgotten-export) The symbol "EventJson" needs to be exported by the entry point index.module.d.ts
getJson: () => EventJson;
getPayload: () => Payload;
// Warning: (ae-forgotten-export) The symbol "JsonProcessor" needs to be exported by the entry point index.module.d.ts
withJsonProcessor: (jsonProcessor: JsonProcessor) => void;
}

// @public
export interface RemoveFromCartEvent {
category?: string;
currency?: string;
name?: string;
quantity: number;
sku: string;
unitPrice?: number;
}

// @public
export interface ScreenViewEvent {
id?: string;
name?: string;
}

// @public
export interface SelfDescribingEvent {
event: SelfDescribingJson;
}

// @public
export type SelfDescribingJson<T extends Record<keyof T, unknown> = Record<string, unknown>> = {
schema: string;
data: T;
};

// @public
export interface SiteSearchEvent {
filters?: Record<string, string | boolean>;
pageResults?: number;
terms: Array<string>;
totalResults?: number;
}

// @public
export interface SocialInteractionEvent {
action: string;
network: string;
target?: string;
}

// @public
export interface StructuredEvent {
// (undocumented)
action: string;
// (undocumented)
category: string;
// (undocumented)
label?: string;
// (undocumented)
property?: string;
// (undocumented)
value?: number;
}

// Warning: (ae-forgotten-export) The symbol "TrueTimestamp" needs to be exported by the entry point index.module.d.ts
// Warning: (ae-forgotten-export) The symbol "DeviceTimestamp" needs to be exported by the entry point index.module.d.ts
//
// @public
export type Timestamp = TrueTimestamp | DeviceTimestamp | number;

// @public (undocumented)
export interface Tracker extends TrackerCore {
setDomainUserId: (userId: string) => void;
setNetworkUserId: (userId: string) => void;
setSessionId: (sessionId: string) => void;
setSessionIndex: (sessionIndex: string | number) => void;
}

// @public
export function tracker(emitters: Emitter | Array<Emitter>, namespace: string, appId: string, encodeBase64: boolean): Tracker;

// @public (undocumented)
export const version: string;

// (No @packageDocumentation comment for this package)