Personyze tracking can be programmatically turned off, on, or queried per visitor — useful for GDPR, CCPA, and other privacy frameworks where users must consent (or actively opt out) before behavioral data is collected.
When to use this
- Cookie consent banners — call
off()by default, thenon()only after the user accepts non-essential / analytics cookies. - Privacy preference centers — let visitors toggle Personyze tracking from a settings page.
- Region-specific compliance — disable tracking for visitors in jurisdictions where consent hasn’t been collected yet.
JavaScript API
Opt out (turn tracking off)
_S_T.system.off()
After this call, no further events are sent to Personyze for the current session. The opt-out state is persisted in a cookie so it survives page navigation.
Opt in (turn tracking on)
_S_T.system.on()
Re-enables event collection. Use this when a visitor grants consent through your cookie banner or preference center.
Check current state
_S_T.system.is_on() // returns true | false
Useful when conditionally rendering UI (“You are currently opted out — click to re-enable”) or in audit logs.
Common implementation pattern
A typical cookie-consent integration looks like this:
// On page load — opt out by default until consent is given
if (!localStorage.getItem('analytics_consent')) {
_S_T.system.off();
}
// When the user accepts the consent banner
function onConsentGranted() {
localStorage.setItem('analytics_consent', 'granted');
_S_T.system.on();
}
// When the user rejects or revokes consent
function onConsentRevoked() {
localStorage.setItem('analytics_consent', 'revoked');
_S_T.system.off();
}
Generated opt-out code
The Personyze admin includes a Privacy & GDPR section under Domain Settings that generates a copy-paste-ready opt-out snippet styled for embedding directly in your privacy policy page. The generated code typically wires up a button that calls _S_T.system.off() and shows the current state via _S_T.system.is_on().
Verifying opt-out is working
- Open your site in a private/incognito window with the dev tools network tab open.
- Filter the requests by
counter.personyze.com. - Trigger the opt-out (call
_S_T.system.off()from the console, or click your privacy banner). - Navigate to a new page on your site. You should see no further requests to
counter.personyze.com. - Run
_S_T.system.is_on()in the console — should returnfalse.
stat-track-lib.js.