UNPKG

@dotcms/analytics

Version:

Official JavaScript library for Content Analytics with DotCMS.

34 lines (32 loc) 1.26 kB
import { DotCMSAnalyticsConfig, DotCMSAnalyticsParams } from '../shared/dot-content-analytics.model'; /** * Analytics plugin for tracking page views and custom events in DotCMS applications. * This plugin handles sending analytics data to the DotCMS server, managing initialization, * and processing both automatic and manual tracking events. * * @param {DotCMSAnalyticsConfig} config - Configuration object containing API key, server URL, * debug mode and auto page view settings * @returns {Object} Plugin object with methods for initialization and event tracking */ export declare const dotAnalytics: (config: DotCMSAnalyticsConfig) => { name: string; config: DotCMSAnalyticsConfig; /** * Initialize the plugin */ initialize: () => Promise<void>; /** * Track a page view event * Takes enriched data from properties and creates final structured event */ page: (params: DotCMSAnalyticsParams) => Promise<void>; /** * Track a custom event * Takes enriched data and sends it to the analytics server */ track: (params: DotCMSAnalyticsParams) => Promise<void>; /** * Check if the plugin is loaded */ loaded: () => boolean; };