Creating a link for the user to manage their consents

NitroPay’s ad script is bundled with our IAB registered CMP to collect data processing consents from users in the European Union. IAB requires the initial prompt be shown automatically, which NitroPay takes care of. If a consent string exists on the user’s device the initial prompt won’t be shown and the user needs a way to bring it back up when they want to manage their consents.

Our CMP is only loaded on your page if the user is accessing from a region where the GDPR is in effect. Because of this, the management link will only be relevant to those specific users and won’t work outside of the EU. We don’t assume the most appropriate place for this link in your unique layout, so consider the 2 methods below and implement the solution that works best for your site.

Simple Implementation #

The CMP will look for an element with id ncmp-consent-link and inject a button when it loads. You can style the button with your site’s stylesheets to match it to your page.

<div id="ncmp-consent-link"></div>

SPAs (single page apps) can instruct the CMP to look for your element and inject the button again with the following.

if (window['__cmp']) {

It’s important to check for the existence of the __cmp property on your window object before running any commands since it will not be there for non-EU users.

Advanced Implementation #

The following example creates a div consent-box that starts out hidden, and is only made visible to users in GDPR zones.

<div id="consent-box" style="display:none">
  <button onclick="window.__cmp('showModal');">
    Update cookie preferences

  if (window["nitroAds"] && window["nitroAds"].loaded) {
    document.getElementById("consent-box").style.display = window["__tcfapi"]
      ? ""
      : "none";
  } else {
      () =>
        (document.getElementById("consent-box").style.display = window["__tcfapi"]
          ? ""
          : "none")

To test GDPR features from regions outside of the zones, append ?gdpr_debug=1 to your URL. E.g.