Skip to main content

# trackActivity()

    function trackActivity(element: Document | null, cb: (...args: unknown[]) => unknown): () => void;

Starts tracking user activity for session management. Monitors user interactions on the specified element and invokes callback.

## Parameters​

### element​

DOM element to track activity on (typically document)

`Document` | `null`

### cb​

(...`args`: `unknown`[]) => `unknown`

Callback function to invoke on user activity

## Returns​

Cleanup function to stop tracking

    (): void;

### Returns​

`void`

## Example​

    const cleanup = trackActivity(document, renewSession);

    // Later, stop tracking
    cleanup();