UNPKG

@deriv-com/analytics

Version:

The analytics package contains all the utility functions used for tracking user events and sending them to the respective platform such as Rudderstack.

30 lines (29 loc) 1.68 kB
import { GrowthBook, InitResponse } from '@growthbook/growthbook'; import { RudderAnalytics } from '@rudderstack/analytics-js'; import { TGrowthbookAttributes, TGrowthbookOptions } from './types'; export type GrowthbookConfigs = { 'tracking-buttons-config': Record<string, boolean>; } & { [key: string]: Record<string, boolean> | string | boolean | []; }; export declare class Growthbook { analytics: RudderAnalytics; GrowthBook: GrowthBook<GrowthbookConfigs>; private static _instance; isLoaded: boolean; status: void | InitResponse; constructor(clientKey: string, decryptionKey: string, growthbookOptions?: TGrowthbookOptions); static getGrowthBookInstance: (clientKey: string, decryptionKey?: string, growthbookOptions?: TGrowthbookOptions) => Growthbook; reapplyExperiment(url?: string): void; private waitForIsLoaded; setAttributes: ({ id, country, user_language, device_language, device_type, utm_source, utm_medium, utm_campaign, is_authorised, url, domain, utm_content, residence_country, loggedIn, network_type, network_downlink, user_id, anonymous_id, account_mode, }: TGrowthbookAttributes) => void; getFeatureValue: <K extends string | number, V extends GrowthbookConfigs[K]>(key: K, defaultValue: V) => import("@growthbook/growthbook").WidenPrimitives<V>; getStatus: () => Promise<{ isLoaded: boolean; status: void | InitResponse; }>; getFeatureState: (id: string) => import("@growthbook/growthbook").FeatureResult<string | boolean | Record<string, boolean> | [] | null>; setUrl: (href: string) => Promise<void>; isOn: (key: string) => boolean; init: () => Promise<void>; }