UNPKG

1.7 kBTypeScriptView Raw
1/// <reference types="node" />
2import { MeasurementParams, MeasurementConfig } from './types';
3export declare function measure(tid: MeasurementParams['tid'], params?: MeasurementParams, config?: MeasurementConfig): Measure;
4declare class Measure {
5 params: MeasurementParams;
6 config: MeasurementConfig;
7 constructor(params?: MeasurementParams, config?: MeasurementConfig);
8 set(this: Measure, params: MeasurementParams, config?: MeasurementConfig): Measure;
9 setCustomDimensions(values: string[]): Measure;
10 setCustomMetrics(values: number[]): Measure;
11 send(this: Measure): Promise<Response | IncomingMessage>;
12 toString(this: Measure): string;
13 pageview(this: Measure, url: string | {
14 host: string;
15 path: string;
16 }): Measure;
17 screenview(this: Measure, screenName: string): Measure;
18 transaction(this: Measure, id: string, affiliation?: string, revenue?: number, shipping?: number, tax?: number): Measure;
19 item(this: Measure, id: string, name: string, price?: number, quantity?: number, code?: string, category?: string): Measure;
20 social(this: Measure, name: string, action: string, actionTarget: string): Measure;
21 event(this: Measure, category: string, action: string, label?: string, value?: number): Measure;
22 timing(this: Measure, category: string, name: string, value: number, label?: string): Measure;
23 exception(this: Measure, description: string, fatal?: boolean): Measure;
24}
25export declare function send(measurement: Measure): Promise<Response | IncomingMessage>;
26export declare function batchSend(measurements: Measure[]): Promise<Response | IncomingMessage>;
27import { IncomingMessage } from 'http';
28export {};