Skip to content
iReveal

Connect the iCustomer pixel to your consent banner

This guide shows you how to connect your iCustomer pixel to your existing consent banner.

New to the pixel? How the iCustomer pixel works explains what it does and what it collects.

On this page

iCustomer does not provide a consent banner. You keep whichever one you already use, and you connect the pixel to it. There are four steps, and your web team can complete all of them without us.

Before you start

Have these ready:

  • The iCustomer pixel installed on your site, from Settings > Pixels.
  • A consent banner already running. Any vendor works.
  • The name of that consent tool, and which of its categories mean analytics, advertising, and personalization. Your banner vendor's documentation will name these.
  • Access to edit your site's <head>, or access to your tag manager.

Who needs to be involved. Steps 1 and 2 are decisions, and the person who owns the website can make them alone. Step 3 is where code gets pasted, so if you do not edit your own site, make the decisions in steps 1 and 2 and pass this guide to whoever manages your website or tag manager. Step 4 is a five-minute check that anyone can run.

Step 1: Decide when the pixel is allowed to run

Pick Option A or Option B. Everything in Step 3 depends on which one you choose, so decide this first.

Option A: hold the pixelOption B: load it silent
How it worksYour consent tool stops the pixel from loading at all until a visitor accepts.The pixel loads right away but sends nothing until your banner tells it consent was given.
Before consentNothing happens. No cookie, no browser storage, no third-party scripts, no data.The pixel sets itself up (see below) but sends no data.
Visitors who ignore the bannerNever seen.Never seen.
Visitor accepts later in the same visitNot counted until they load a new page.Counted immediately.
Where it is set upIn your consent tool or tag manager.In your website code.
Pick this whenNothing may be placed on a visitor's device before they consent.You want the fastest recovery when a visitor accepts.

If you have visitors in the EU or UK, read this before choosing. Rules in those regions generally cover anything stored on or read from a visitor's device, not only data sent back to us. Under Option B the pixel stores an identifier and loads a third-party script as soon as it loads, before any consent is given. If your requirement is that nothing touches the device until a visitor accepts, Option A is the option that meets it.

What Option B does at load, before consent. Consent controls whether data is sent. It does not stop the pixel setting itself up. As soon as it loads, the pixel sets a first-party cookie lasting 400 days, writes a visitor token to browser storage, loads the third-party visitor de-anonymisation script if your workspace uses one, and starts listening for form submissions and page changes. Nothing is transmitted to iCustomer until a purpose is granted, but those four things do happen. This is the only real difference between the two options, and it is why EU and UK traffic points at Option A.

Write down which option you picked. You need it in Step 3.

Step 2: Decide what the pixel is allowed to do

iCustomer uses three separate purposes rather than one on/off switch, so you can grant exactly what your visitor agreed to.

PurposeWhat it controlsUsually called this on your banner
analyticsPage views, events, and form capture. Required for almost everything.Statistics, Analytics, Performance
personalizationIdentifying who a visitor is, and showing contact details in your dashboard.Preferences, Functional
advertisingPassed to your connected tools. Controls nothing inside iCustomer today.Marketing, Targeting

Grant them independently. analytics on its own gives you traffic and behaviour with nobody named. Adding personalization is what turns a visitor into a named contact.

Write down which purposes you want. You need them in Step 3 too.

Go to the section for the option you picked in Step 1. Follow that one only. The two options are alternatives, and doing both will stop the pixel working.

Option A: hold the pixel until the visitor accepts

Your consent tool does the work here. It blocks the iCustomer snippet from running until the visitor accepts the category you assign to it, then releases it.

A1. Set your snippet's consent values to what the visitor will have agreed to. Because the pixel only loads after consent, its consent values should be set to true for the purposes covered by the category you gate it behind.

window.sgnl.init({
  workspace_id: 'ws_xxx',
  public_key: 'pk_xxx',
  consent: { analytics: true, advertising: false, personalization: true }
});

Set personalization to false if the category you gate on does not cover identifying visitors. Do not leave all three as false, or the pixel will load after the visitor accepts and still do nothing. This is the most common mistake with Option A.

A2. Configure your tool to hold the tag. Google Tag Manager is the most reliable way to do this, and it works no matter which banner sits behind it.

  1. Create a Custom HTML tag containing your iCustomer snippet.
  2. Open Advanced Settings > Consent Settings.
  3. Under Require additional consent for tag to fire, add analytics_storage.
  4. Set the trigger to fire on page view and on your banner's consent-update event.
  5. Publish.

Two traps worth knowing. Do not use the Consent Initialization trigger for this tag, as that trigger is reserved for your banner's own tag. And GTM counts a "once per page" tag as used even when consent blocks it, so a tag triggered only on page view will never fire for a visitor who accepts after the page loads. Point 4 above is what prevents that.

Not using a tag manager? Cookiebot and OneTrust can hold the tag directly, using their category attributes on the snippet. Wix does it automatically once you assign the pixel a category under Settings > Advanced > Custom Code. One warning: our snippet is an inline block rather than a plain script tag, and a few content management systems strip the category attribute when they save the page. If you find the pixel running before consent, that is why, and Google Tag Manager avoids it entirely. The HubSpot cookie banner cannot hold a tag at all. If HubSpot is your banner, use Option B.

Option A is complete. Go to Step 4.

Option B: load the pixel and control it from your banner

The pixel loads with everything switched off, and your banner turns purposes on when the visitor decides.

B1. Set your snippet to start silent. The snippet from Settings > Pixels already contains a consent block. Set all three to false.

window.sgnl.init({
  workspace_id: 'ws_xxx',
  public_key: 'pk_xxx',
  consent: { analytics: false, advertising: false, personalization: false }
});

Do not delete the consent block. If it is missing, the pixel falls back to analytics: true and starts collecting before your banner has said anything.

B2. Paste this helper above your banner code. The pixel loads asynchronously, so if your banner decides before the pixel has finished loading, the call fails silently and the visitor's choice is lost. This helper holds the decision and applies it as soon as the pixel is ready.

window.icApplyConsent = (function () {
  var pending = null, waited = 0;
  function flush() {
    if (!pending || !window.sgnl || !window.sgnl.ready) return;
    var c = pending;
    pending = null;
    window.sgnl.ready.then(function () { window.sgnl.consent(c); });
  }
  var timer = setInterval(function () {
    waited += 50;
    if ((window.sgnl && window.sgnl.ready) || waited > 10000) {
      clearInterval(timer);
      flush();
    }
  }, 50);
  return function (consent) { pending = consent; flush(); };
})();

B3. Wire up your consent tool. Find yours below and paste the matching block. Only two things change between tools: the event your banner fires, and what it calls each category. The call into the pixel is identical every time.

HubSpot fires its listener once when the page loads and again on every change, so this one block covers everything. Paste it in your site's <head>.

<script>
  var _hsp = (window._hsp = window._hsp || []);
  _hsp.push(['addPrivacyConsentListener', function (consent) {
    var c = consent.categories || {};
    icApplyConsent({
      analytics:       !!c.analytics,
      advertising:     !!c.advertisement,
      personalization: !!c.functionality
    });
  }]);
</script>

Cookiebot

Turn Cookiebot's automatic blocking off for the iCustomer snippet so it always loads, then paste this.

function applyCookiebotConsent() {
  icApplyConsent({
    analytics:       Cookiebot.consent.statistics,
    advertising:     Cookiebot.consent.marketing,
    personalization: Cookiebot.consent.preferences
  });
}
window.addEventListener('CookiebotOnConsentReady', applyCookiebotConsent);
window.addEventListener('CookiebotOnAccept',       applyCookiebotConsent);
window.addEventListener('CookiebotOnDecline',      applyCookiebotConsent);

Pick one, not both. If you leave automatic blocking on and also wire up this callback, Cookiebot blocks the snippet and the callback has nothing to talk to. Nothing gets tracked, and it looks like a bug.

OneTrust

window.addEventListener('OneTrustGroupsUpdated', function (e) {
  var g = e.detail || [];
  icApplyConsent({
    analytics:       g.indexOf('C0002') > -1,
    advertising:     g.indexOf('C0004') > -1,
    personalization: g.indexOf('C0003') > -1
  });
});

If you renamed or renumbered your OneTrust groups, substitute your own IDs. This is the most common thing people get wrong with OneTrust.

Google Tag Manager

Deploy the snippet as a Custom HTML tag firing unconditionally, then add a second Custom HTML tag on your banner's consent-update event that calls icApplyConsent with the values from your banner's dataLayer variables.

Every other banner works the same way. Find the event your banner fires when a visitor decides, read its categories, and call the helper with them.

// Replace with your banner's own event and category names.
yourBanner.onConsentChange(function (categories) {
  icApplyConsent({
    analytics:       categories.statistics,
    advertising:     categories.marketing,
    personalization: categories.preferences
  });
});

That is the whole contract. It covers CookieYes, Complianz, Termly, Iubenda, Osano, Didomi, and the rest. For website builders: Wix uses its own Consent Policy API, Shopify uses Shopify.customerPrivacy with its visitorConsentCollected event, and Webflow and Squarespace have no banner of their own, so follow the recipe for whichever tool you installed.

Step 4: Check that it worked

  1. Open your site in a private window, with your browser's developer tools on the Network tab.
  2. Decline the banner, then browse two or three pages. You should see no event requests to iCustomer.
  3. Reload, accept the banner, then browse again. Event requests should now appear.
  4. Open your preference centre and withdraw consent. Event requests should stop on the next page.

If step 3 produces nothing, work through the troubleshooting list below.

Troubleshooting

  • Nothing is ever tracked, even after accepting. Most often you are running both options at once: your consent tool is blocking the snippet and you wired up a callback. Pick one. On Cookiebot, check that automatic blocking is off if you chose Option B.
  • On Option A, the pixel loads but never records anything. Your snippet's consent values are still all false. See A1.
  • Accepting works, but only after a page reload. Your consent call is not reaching the pixel in time. Make sure you are using the icApplyConsent helper rather than calling window.sgnl.consent() directly.
  • Accepting does nothing in Google Tag Manager. Your tag is probably triggered only on page view. Add your banner's consent-update event as a trigger.
  • Visitors are tracked but never identified. You granted analytics but not personalization. Identification needs both.
  • Category names do not match. Banner vendors change these. Check your vendor's current documentation and substitute their names into the call.

Get help

The setup runs on your side, and your web team owns it. If your consent tool is not listed here, or something behaves differently from this guide, send your iCustomer contact the name of your consent tool and the event it fires, and we will tell you which pattern to follow. Every tool follows one of the two options above.

This guide describes what the iCustomer pixel does and how to connect it to a consent banner. It is a technical description, not legal advice. What your business is required to do depends on where your visitors are and which rules apply to you, so confirm your obligations with your own privacy or legal team.