UNPKG

@dotcms/analytics

Version:

Official JavaScript library for Content Analytics with DotCMS.

49 lines (47 loc) 1.9 kB
import { BrowserEventData, DotContentAnalyticsConfig } from './dot-content-analytics.model'; /** * Retrieves analytics attributes from a given script element. * * @return {DotAnalyticsConfig | null} - The analytics attributes or null if there are no valid attributes present. */ export declare const getDataAnalyticsAttributes: (location: Location) => DotContentAnalyticsConfig; /** * Retrieves the analytics script tag from the document. * * @returns {HTMLScriptElement} - The analytics script tag. */ export declare const getAnalyticsScriptTag: () => HTMLScriptElement; /** * Retrieves the browser event data. * * @param {Location} location - The location object. * @returns {BrowserEventData} - The browser event data. */ export declare const getBrowserEventData: (location: Location) => BrowserEventData; /** * Extracts UTM parameters from a given URL location. * * @param {Location} location - The location object containing the URL. * @returns {Record<string, string>} - An object containing the extracted UTM parameters. */ export declare const extractUTMParameters: (location: Location) => Record<string, string>; /** * A function to redirect the user to a new URL. * * @param {string} href - The URL to redirect to. * @returns {void} */ export declare const defaultRedirectFn: (href: string) => string; /** * Checks if the current environment is inside the dotCMS editor. * * @returns {boolean} - True if inside the editor, false otherwise. */ export declare const isInsideEditor: () => boolean; /** * Creates an analytics instance. * * @param {DotContentAnalyticsConfig} config - The configuration object for the analytics instance. * @returns {Analytics | null} - The analytics instance or null if there is an error. */ export declare const createAnalyticsInstance: (config: DotContentAnalyticsConfig) => import('analytics').AnalyticsInstance | null;