Leading Consent Management Platform

Compliant with GDPR, CCPA, COPPA, LGPD, PECR, PDPA, PIPEDA, and more.

Third party JavaScript Tags Integration

You can load your third-party JavaScript tags only when the visitor's consent allows them. Choose the method that fits where your tags are:

Your tags areUse
In your page codeUnicScript attributes on the tags, or the Consent Ready API (unicReady and unicUpdate) in your own code
In Google Tag ManagerGoogle tags: Consent Mode. Other tags: a unic_data trigger with a consent condition (Method 3)
Not in your code, and you do not want to change itThe Tags Loader in your dashboard

Method 1: UnicScript

For tags in your page code, change the tag's type to text/unicscript and add the purpose, category or vendor it needs. See UnicScript.

Method 2: JavaScript API

Run your own code when consent allows it. If you installed UniConsent with the single tag, unicReady runs your code once consent is final, and unicUpdate runs it again after every change. See the Consent Ready API and the JavaScript API.

Method 3: Google Tag Manager

Google tags read Google Consent Mode, so they can load on the All Pages trigger. See Consent Mode for Google Tag Manager.

For other tags, use the unic_data event, which UniConsent pushes to the data layer with the visitor's consent:

  1. Create a Data Layer Variable named UNIC_IS_LOAD. Under Format Value, turn on Convert true to 1 and Convert false to 0.
  1. Create a Custom Event trigger on unic_data with the condition UNIC_IS_LOAD equals 1.
  1. Load your tag with this trigger, and set the tag's firing option to Once per page.

UNIC_IS_LOAD is true where IAB TCF applies only when the visitor allows storage or any custom vendor: it is false before a choice and after a reject. It is always true where IAB TCF does not apply. Consent category choices and a US opt-out do not change it, so for those also add a condition on the matching variable: UNIC_EP_1 to UNIC_EP_4 for consent categories, or UNIC_P_1 to UNIC_P_10 for purposes.

For a custom vendor, add the vendor in the CMP to get its ID, then also check its consent: for example customVendors.1 equals true for vendor 1.

unic_data is pushed at page load and again after each consent choice or change, so a trigger on it can fire more than once on a page. All its variables are listed in the JavaScript API.