Tugus Docs

Consent API

Integrate Tugus with your own consent manager or the built-in banner.

Integration with your own consent manager or the bundled Tugus banner.

// Set consent (after user confirmation)
tugus.setConsent({
  analytics:  true,
  marketing:  true,
  necessary:  true,
})

// Read the current consent
const consent = tugus.getConsent()
// → { analytics: true, marketing: false, necessary: true }

// Google Consent Mode v2 — automatic via gtag() hook
// Tugus automatically reads gtag('consent', 'update', {...})
// No additional code required if GCM is configured

Consent is enforced on two levels:

  1. Your consent manager / integration. Whatever supplies the consent state — this Consent API, the built-in banner, gtag Consent Mode, or a shop integration — sets which signals are granted, and depending on your setup may prevent an event from firing at all.
  2. Tugus, server-side, per destination. Tugus reads the consent state on every event and decides forwarding per platform. A platform that requires ad or PII consent is skipped without it — unless a click ID (gclid, fbclid, …) enables a modelled conversion. GA4 still receives a cookieless ping with denied flags (Consent Mode).

pageview is not exempt. It maps to platform events (Meta PageView, TikTok Pageview, …) and is gated exactly like any other event — there is no "technically necessary" bypass that always sends it. What is always sent without consent is only the GA4 cookieless ping.