/** Reference: https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#generate-custom-sdk-code-snippets */ export interface WebTrackerConfig { /** mandatory, app key for your app created in Countly */ app_key: string; /** your Countly server URL - you may also use your own server URL or IP here */ url: string; /** how often a session should be extended, expressed in seconds (default: 60 seconds) */ session_update?: number; /** how long until a cookie session should expire, expressed in minutes (default: 30 minutes) */ session_cookie_timeout?: number; /** country code for your visitor (default: VN) */ country_code?: string; /** name of the city of your visitor */ city?: string; /** IP address of your visitor */ ip_address?: string; /** to identify a visitor, will be autogenerated if not provided */ device_id?: string; /** the version of your app or website */ app_version?: string; /** output debug info into console (default: false) */ debug?: boolean; /** force using post method for all requests (default: false) */ force_post?: boolean; /** Pass true if you are implementing GDPR compatible consent management. This would prevent running any functionality without proper consent (default: false) */ require_consent?: boolean; /** use cookies to track sessions (default: true) */ use_session_cookie?: boolean; /** maximum amount of events to send in one batch (default: 100) */ max_events?: number; /** maximum amount of breadcrumbs to store for crash logs (default: 100) */ max_logs?: number; /** option to ignore traffic from bots (default: true) */ ignore_bots?: boolean; /** array with referrers to ignore (default: none) */ ignore_referrers?: Array; /** ignore prefetching and pre-rendering from counting as real website visits (default: true) */ ignore_prefetch?: boolean; /** ignore this current visitor (default: false) */ ignore_visitor?: boolean; /** set an interval for how often inspections should be made to see if there is any data to report and then report it (default: 500 ms) */ interval?: number; /** maximum amount of queued requests to store (default: 1000) */ queue_size?: number; /** set the time to wait in seconds after a failed connection to the server (default: 60 seconds) */ fail_timeout?: number; /** the time limit after which a user will be considered inactive if no actions have been made. No mouse movement, scrolling, or keys pressed. Expressed in minutes (default: 20 minutes) */ inactivity_time?: number; /** Array of trusted domains (as string) that can trigger heatmap script loading. By default the SDK whitelists your server url. */ heatmap_whitelist?: string[]; /** object instructing which UTM parameters to track (default: {"source":true, "medium":true, "campaign":true, "term":true, "content":true}) */ utm?: any; /** enable automatic remote config fetching, provide the callback function to be notified when fetching is complete (default: false) */ remote_config?: boolean; /** opts in the user for A/B testing while fetching the remote config (default: true) */ rc_automatic_optin_for_ab?: boolean; /** set it to true to use the explicit remote config API (default: false) */ use_explicit_rc_api?: boolean; /** have a separate namespace for persistent data when using multiple trackers on the same domain */ namespace?: string; /** Set to false to disable domain tracking, so no domain data would be reported (default: true) */ track_domains?: boolean; /** object to override or add headers to all SDK requests */ headers?: any; /** What type of storage to use, by default uses local storage and would fallback to cookies, but you can set values "localstorage" or "cookies" to force only specific storage, or use "none" to not use any storage and keep everything in memory */ storage?: any; /** provide metrics for this user, otherwise, it will try to collect everything which is possible */ /** _os - the name of platform/operating system _os_version - version of platform/operating system _device - device model name _resolution - screen resolution of the device _carrier - carrier or operator used for connection _density - screen density of the device _locale - locale or language of the device in ISO format _store - a source where the user came from _browser - browser name _browser_version - browser version _ua - user agent string */ metrics?: any; } export interface WebTrackerOptions { /** Default: [['track_errors'], ['track_sessions']] */ trackers?: Array<[ ('track_sessions' | 'track_links' | 'track_errors' | 'track_pageview' | 'track_forms' | 'track_clicks' | 'track_scrolls'), any ]>; /** Features for Consent */ /** Default: { all:["sessions","events","views","scrolls","clicks","forms","crashes","attribution","users"] } */ /** Reference: https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#features-for-consent */ groupFeatures?: any; /** Consents must match the keys in the groupFeatures. Default: ['all'] */ consents?: string[]; } export interface WebTrackerEventData { /** number of events (default: 1) */ count?: number; /** sum to report with the event (optional) */ sum?: number; /** duration expressed in seconds, meant for reporting with the event (optional) */ dur?: number; segmentation?: object; } export interface PageViewTrackerProps { effect: (location: Location) => ReturnType; }