UNPKG

ngx-hotjar

Version:

A simple ng wrapper to load hotjar dependency by angular way

90 lines (89 loc) 2.4 kB
import { IHotjarSettings } from '../interfaces/i-hotjar-settings'; import { HjFn } from '../types/hj'; export declare class NgxHotjarService { /** @ignore */ private _hj; /** @ignore */ private settings; /** * Provide direct access to the `hj.*` static functions. If the desired function is not available on type definition, you can cast to `any` as following. * ```typescript (hjService.lib as any).myBrandNewStaticFn() ``` */ get lib(): HjFn; /** @ignore */ constructor( /** @ignore */ _hj: HjFn, /** @ignore */ settings: IHotjarSettings); /** Expose Hotjar Function calls */ hj(...args: Array<any>): void; /** * Fires an PageView event on Hotjar. Use this method to trigger an virtual url path. The same as * ```typescript hj('vpv', path) ``` */ virtualPageView(path: string): void; /** * Fires an event on Hotjar. Use this method to trigger events on forms and start video recordings. Same as * ```typescript hj('trigger', path) ``` */ trigger(path: string): void; /** * Allows you to tag recordings on Hotjar of all visitors passing through a page. * * You can create multiple tags by providing aditional arguments * * @deprecated * ```typescript hjService.tagRecording(['tag1', 'tag2', 'tag3', ...]); hj('tagRecording', ['tag1', 'tag2', 'tag3', ...]) ``` */ tagRecording(tagOrCollection: string[]): void; /** * Allows you to tag recordings on Hotjar of all visitors passing through a page. * * You can create multiple tags by providing aditional arguments * ```typescript hjService.tagRecording('tag1', 'tag2', 'tag3', ...); hj('tagRecording', ['tag1', 'tag2', 'tag3', ...]) ``` */ tagRecording(tagOrCollection: string, ...tags: Array<string>): void; /** * This option is available in case you need to set up page change tracking manually * within your app's router. * ```typescript hj('stateChange', path) ``` */ stateChange(path: string): void; /** * Signals form submission success * ```typescript hj('formSubmitSuccessful'); ``` */ formSubmitSuccessful(): void; /** * Signals form submission failure * ```typescript hj('formSubmitFailed'); ``` */ formSubmitFailed(): void; }