For the complete documentation index, see llms.txt. This page is also available as Markdown.

Opt-out

When opt-out is enabled, the SDK stops sending all events.

Configuration at Initialization

const config = {
    optOutTracking: true
};
const hackleClient = Hackle.createInstance("YOUR_BROWSER_SDK_KEY", config);

Runtime Opt-out Control

hackleClient.setOptOutTracking(true);
hackleClient.setOptOutTracking(false);
const isOptOut = hackleClient.isOptOutTracking();

Persistence Management

function saveOptOutState(optOut) {
    localStorage.setItem("hackle_opt_out", JSON.stringify(optOut));
    hackleClient.setOptOutTracking(optOut);
}

function getOptOutConfig() {
    const optOut = JSON.parse(localStorage.getItem("hackle_opt_out") || "false");
    return {
        optOutTracking: optOut
    };
}

const config = getOptOutConfig();
const hackleClient = Hackle.createInstance("YOUR_BROWSER_SDK_KEY", config);

Last updated