@consumidor-positivo/ts-utils - v1.13.0
    Preparing search index...

    Class ClarityHelpers

    Microsoft Clarity integration helpers.

    This class provides static methods to interact with Microsoft Clarity analytics, including user identification, custom event tagging, and version tracking.

    import { ClarityHelpers } from '@consumidor-positivo/ts-utils/tools';

    // Identify a user
    await ClarityHelpers.identify({
    userId: 'user123',
    sessionId: 'session456',
    pageId: 'home-page'
    });

    // Add custom tags
    await ClarityHelpers.tag('userType', 'premium');

    // Set app version
    ClarityHelpers.setAppVersion('v1.2.3');
    Index

    Constructors

    Methods

    • Gets the Microsoft Clarity instance from the global window object.

      Returns any

      The Clarity instance if available, undefined otherwise

    • Identifies a user session in Microsoft Clarity.

      Parameters

      Returns Promise<void>

      Promise that resolves when identification is complete

    • Sets the application version tag in Microsoft Clarity.

      Parameters

      • appVersion: `v${number}.${number}.${number}`

        The application version in semantic version format (e.g., "v1.2.3")

      Returns void

    • Sets a custom tag in Microsoft Clarity.

      Parameters

      • key: string

        The tag key

      • value: string

        The tag value

      Returns Promise<void>

      Promise that resolves when the tag is set