export default AdAnalyticsJS; export type EventDict = { [x: string]: any; }; export type IConstructorArgs = { /** * 初始化标识 */ sign: string; /** * 是否开启日志 */ log?: boolean; /** * 是否需要上报 */ needReport?: boolean; /** * 公共用户信息 */ commonConfig?: ICommonInfo; }; export type ICommonInfo = { [x: string]: any; }; /** * @typedef {Object.} EventDict */ /** * @typedef {object} IConstructorArgs * @property {string} sign 初始化标识 * @property {boolean} [log] 是否开启日志 * @property {boolean} [needReport] 是否需要上报 * @property {ICommonInfo} [commonConfig] 公共用户信息 * */ /** * @typedef {Object.} ICommonInfo * */ declare class AdAnalyticsJS { static instance: any; /** * * @param {IConstructorArgs} args * @returns {AdAnalyticsJS} */ static build(args: IConstructorArgs): AdAnalyticsJS; /** * * @returns {AdAnalyticsJS} */ static getInstance(): AdAnalyticsJS; /** * * @param {IConstructorArgs} args * @returns {AdAnalyticsJS} */ static "new"(args: IConstructorArgs): AdAnalyticsJS; /** * @param {IConstructorArgs} args */ constructor(args: IConstructorArgs); /** @private */ /** @type {Logger} */ _logger: Logger; _initSign: string; _needReport: boolean; /** @type {ICommonInfo | null} */ _commonConfig: ICommonInfo | null; /** * 初始化 比如环境配置,api地址、日志等级等 * @param {IConstructorArgs} args */ initialize(args: IConstructorArgs): IConstructorArgs; /** * 追踪自定义事件 * 用户交互,如点击、提交 * * @template {keyof EventDict} K * @param {K} eventName - The name of the event to track. * @param {EventDict[K]} properties - The properties associated with the event. * @param {object} [debugParams] - The debug parameters. * @param {string} [debugParams.sign] - Whether to enable debug mode. */ track(eventName: K, properties: EventDict[K], debugParams?: { sign?: string; }): void; /** * 获取公共用户信息 * @public * @param {string|number} [v] - key * @returns {unknown} */ public getCommonInfo(v?: string | number): unknown; /** * 获取埋点公共用户信息 * @protected * @returns {ICommonInfo} */ protected getTrackCommonInfo(): ICommonInfo; /** * 识别用户身份 * 用户登录后,关联用户信息 * @param {string|number} user_id - 用户id * @param {ICommonInfo} info - 用户信息 * @returns {AdAnalyticsJS} 返回实例本身,支持链式调用 */ identify(user_id: string | number, info: ICommonInfo): AdAnalyticsJS; /** * 合并用户身份 * 匿名用户转为登录用户 * @returns */ alias(): any; /** * 追踪页面浏览 * SPA 路由切换,或手动触发页面事件 * @returns */ pages(): any; /** * 追踪页面浏览 进入页面 * * @template {'cpage'} K * @param {K} eventName - The name of the event to track. * @param {EventDict[K]} properties - The properties associated with the event. */ page(eventName: K, properties: EventDict[K]): void; /** * * @param {EventDict['cpage']} properties * @returns */ cpage(properties: EventDict["cpage"]): void; /** * 站位方法,没有任何左右 * @returns */ placeholder(): any; } import { Logger } from '@ad-execute-manager/logger';