clarity-js
Version:
An analytics library that uses web page interactions to generate aggregated insights
22 lines (17 loc) • 572 B
text/typescript
import { Dimension } from "@clarity-types/data";
import * as dimension from "@src/data/dimension";
const enum ConsentType {
None = 0,
Implicit = 1,
General = 2,
}
export function config(track: boolean): void {
trackConsent(track ? ConsentType.Implicit : ConsentType.None);
}
// When we get consent signal as false, we restart the service and track config as false.
export function consent(): void {
trackConsent(ConsentType.General);
}
function trackConsent(consent: ConsentType): void {
dimension.log(Dimension.Consent, consent.toString());
}