Consent Docs

Install with a tag manager or CMS

Load the consent runtime through Google Tag Manager, the WordPress plugin or a Shopify theme when you cannot edit the page head yourself.

How-to3 min readFor web, backend and mobile developers

Use one of these when Google Tag Manager, WordPress or Shopify decides what goes in your pages. If you can edit <head> yourself, install the script tag instead.

Before you start#

  • A publishable key, which starts with pk_, with your site's origin on its list. See Create a key.
  • The address of your deployment, such as https://console.dpconsent.com/consent.
  • For Tag Manager and WordPress, the files under integrations/gtm and integrations/wordpress. They ship with the product.

Google Tag Manager#

The template sets the Consent Mode defaults first, then loads the runtime, which sends the updates.

  1. In Tag Manager, open Templates → Tag Templates → New.
  2. Choose Import from the menu, select piedap-consent.tpl and save the template.
  3. Create a tag from the template.
  4. Enter your deployment's https:// address in Consent API URL.
  5. Enter your pk_… key in Publishable key.
  6. Fire the tag on Consent Initialization – All Pages.
  7. Publish the container and open your site. The banner appears.

Tag Manager cannot hold tags in your HTML

Tag Manager loads scripts after its own container starts. Google tags and tags gated by Tag Manager's consent settings work. Scripts written directly in your page have already run. Mark those up as in Hold tags until consent, or use the plain script tag.

For tags without built-in consent checks, trigger on the custom event piedap_consent_update. Read a data layer variable such as piedap_consent.categories.MARKETING. The payload is in Browser runtime events.

Template fields
Field Default What it does
Wait for update (milliseconds) 500 How long Google tags hold their first hit
Redact ad click identifiers while ad_storage is denied On Sets ads_data_redaction
Pass ad click information through URLs while cookies are refused Off Sets url_passthrough
Regions that start granted (opt-out regions) Empty Region codes such as US or US-CA where every signal starts granted
This site uses IAB TCF and This site uses IAB GPP Off Install the __tcfapi or __gpp stub at once

WordPress#

The plugin prints the tag first in <head> and marks it so common script optimisers leave it alone.

  1. Copy the plugin directory to wp-content/plugins/piedap-consent.
  2. In WordPress admin, activate the plugin.
  3. Open Settings → PIEDAP Consent.
  4. Enter your deployment's address in API URL.
  5. Enter your pk_… key in Publishable key.
  6. Save. The page shows the tag the plugin prints under Current tag.

Optional settings on the same page:

Setting What it does
CDN URL Serves the script from a CDN and sends the API address as data-piedap-api
Default country override Uses a two-letter country code instead of the detected one. For testing
IAB TCF, IAB GPP Install the __tcfapi or __gpp stub at once
Pinned build Prints the versioned file with its integrity attribute

Shopify#

  1. In the console, open Install and copy the Shopify tag under Integrations.
  2. In Shopify admin, open Online Store → Themes → Edit code.
  3. Open layout/theme.liquid.
  4. Paste the tag as the first line inside <head>, above every other script.
  5. Save, then open your shop. The banner appears.

Shopify's own pixels run in a sandbox the runtime cannot reach. They follow Shopify's Customer Privacy API, so the runtime passes every answer on to it:

Shopify field Follows the category
analytics ANALYTICS
marketing MARKETING
preferences FUNCTIONAL
sale_of_data SALE_OR_SHARING

Checkout is not held: automatic blocking has no checkout or payment hosts on its list.

↑↓ to move, Enter to open