|
| 1 | +// Generated by typings |
| 2 | +// Source: https://raw.githubusercontent.com/typed-typings/npm-universal-analytics/2d334dadcfdf190456dbbe1ad60ede8c5fd47bfa/index.d.ts |
| 3 | +declare module 'universal-analytics' { |
| 4 | +function ua (tid: string, cid?: string, options?: ua.Options): ua.Visitor; |
| 5 | + |
| 6 | +namespace ua { |
| 7 | + export interface Options { |
| 8 | + strictCidFormat?: boolean; |
| 9 | + https?: boolean; |
| 10 | + requestOptions: RequestOptions; |
| 11 | + } |
| 12 | + |
| 13 | + export interface RequestOptions { |
| 14 | + headers?: any; |
| 15 | + } |
| 16 | + |
| 17 | + export interface MiddlewareOptions { |
| 18 | + cookieName?: string; |
| 19 | + } |
| 20 | + |
| 21 | + export function middleware (tid: string, options: MiddlewareOptions): (req: any, res: any, next: (err: Error) => any) => void; |
| 22 | + |
| 23 | + export function createFromSession (session: any): ua.Visitor; |
| 24 | + |
| 25 | + export type Callback = (err?: Error, count?: number) => any; |
| 26 | + |
| 27 | + export class Visitor { |
| 28 | + constructor (tid: string, cid?: string, options?: Options); |
| 29 | + |
| 30 | + cid: string; |
| 31 | + tid: string; |
| 32 | + options: Options; |
| 33 | + requestOptions: RequestOptions; |
| 34 | + |
| 35 | + debug (debug?: boolean): this; |
| 36 | + reset (): this; |
| 37 | + |
| 38 | + send (callback?: Callback): void; |
| 39 | + |
| 40 | + pageview (path: string, callback?: Callback): this; |
| 41 | + pageview (params: Object, callback?: Callback): this; |
| 42 | + pageview (path: string, hostname: string, callback?: Callback): this; |
| 43 | + pageview (path: string, title: string, hostname: string, callback?: Callback): this; |
| 44 | + |
| 45 | + event (category: string, action: string, callback?: Callback): this; |
| 46 | + event (category: string, action: string, label: string, callback?: Callback): this; |
| 47 | + event (category: string, action: string, label: string, value: any, callback?: Callback): this; |
| 48 | + event (category: string, action: string, label: string, value: any, params: Object, callback?: Callback): this; |
| 49 | + event (params: Object, callback: Callback): this; |
| 50 | + |
| 51 | + transaction (id: string, callback?: Callback): this; |
| 52 | + transaction (id: string, revenue: number, callback?: Callback): this; |
| 53 | + transaction (id: string, revenue: number, shipping: number, callback?: Callback): this; |
| 54 | + transaction (id: string, revenue: number, shipping: number, taxping: number, callback?: Callback): this; |
| 55 | + transaction (id: string, revenue: number, shipping: number, taxping: number, affiliation: string, callback?: Callback): this; |
| 56 | + transaction (params: Object, callback?: Callback): this; |
| 57 | + |
| 58 | + item (price: number, callback?: Callback): this; |
| 59 | + item (price: number, quantity: number, callback?: Callback): this; |
| 60 | + item (price: number, quantity: number, sku: number, callback?: Callback): this; |
| 61 | + item (price: number, quantity: number, sku: number, name: string, callback?: Callback): this; |
| 62 | + item (price: number, quantity: number, sku: number, name: string, variation: string, callback?: Callback): this; |
| 63 | + item (price: number, quantity: number, sku: number, name: string, variation: string, params: Object, callback?: Callback): this; |
| 64 | + item (params: Object, callback?: Callback): this; |
| 65 | + |
| 66 | + exception (description: string, callback?: Callback): this; |
| 67 | + exception (description: string, fatal:boolean, callback?: Callback): this; |
| 68 | + exception (params: Object, callback?: Callback): this; |
| 69 | + |
| 70 | + timing (category: string, callback?: Callback): this; |
| 71 | + timing (category: string, variable: string, callback?: Callback): this; |
| 72 | + timing (category: string, variable: string, time: number, callback?: Callback): this; |
| 73 | + timing (category: string, variable: string, time: number, label: string, callback?: Callback): this; |
| 74 | + timing (params: Object, callback?: Callback): this; |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +export = ua; |
| 79 | +} |
0 commit comments