Intempt Docs
GuidesPrivacy

Cookie Consent Banner Setup

Wire your own cookie consent banner to the JavaScript SDK: hold tracking until a visitor responds, then log their decision with the consent method.

Overview

Intempt doesn't ship a built-in cookie consent banner. You build the banner yourself, either custom markup or a third-party consent management platform, and wire its accept/reject actions to the JavaScript SDK. The SDK gives you two building blocks for this: optIn()/optOut() to control whether tracking calls fire at all, and consent() to log the visitor's decision against a consent category.

Once a decision is logged with consent(), it shows up on that customer's Privacy tab, and it can gate which categories a journey is allowed to message from the Journey builder.

📘 Good to know

This guide covers wiring the SDK to a banner you already have. To define the consent categories you'll pass to consent() (for example analytics or marketing), see Managing consents.

Before you begin

You need:

  1. The JavaScript SDK installed on your site. See Basic Intempt installation.
  2. At least one consent category already configured for your project, matching the category value your banner will send. See Managing consents for how categories are defined.

Setting up the banner

Step 1: Decide whether to hold tracking until the visitor responds

Tracking is on by default: isUserOptIn() returns true until you call optOut(). If your banner needs to work opt-in-first, call optOut() as soon as the install snippet loads, before the visitor has answered the banner:

<script>
  intempt.optOut();
</script>

📘 Good to know

Every tracking method, including identify, track, record, and consent itself, silently does nothing while a user is opted out. If you call optOut() in this step, call optIn() first inside your banner's click handlers, or the consent() call in Step 3 won't record anything.

Step 2: Build the banner

Add your own banner markup, or embed a third-party consent management platform. It needs at least an accept action and a reject action, each wired to a click handler.

Step 3: Record the visitor's decision

Call consent() from each handler, matching category to the category you defined in Settings:

function onAccept() {
  intempt.optIn();
  intempt.consent({
    action: 'accept',
    validUntil: Date.now() + (365 * 24 * 60 * 60 * 1000),
    category: 'analytics'
  });
}

function onReject() {
  intempt.optIn();
  intempt.consent({
    action: 'reject',
    validUntil: Date.now() + (365 * 24 * 60 * 60 * 1000),
    category: 'analytics'
  });
  intempt.optOut();
}

optIn() runs first in both handlers so consent() can actually fire, since it's one of the methods gated by opt-in status. onReject calls optOut() again afterward so tracking stays off once the rejection is logged.

For the full consent() parameter table and the optIn/optOut/isUserOptIn reference, see the JavaScript SDK reference.

Where to go next

On this page