Skip to main content

Vue / Browser — Opt-out

Allow users to opt out of tracking. When opted out, no events are captured.

optOut()

Disable tracking for the current user. No events will be captured while opted out. The opt-out preference is persisted in localStorage. When to use: When the user requests to disable tracking (e.g. privacy settings, GDPR compliance).

optIn()

Re-enable tracking for the current user. Events will be captured again. When to use: When the user requests to re-enable tracking.

hasOptedOut()

Check if the user has opted out. Returns boolean. When to use: To conditionally show UI or check tracking status.

Vue example

Vanilla JS example

Persistence

The opt-out preference is stored in localStorage with the key signal_opt_out. It persists across page reloads and browser sessions.

See also