Skip to main content

IAB TCF 2.3

The IAB Europe Transparency and Consent Framework (TCF) is the standard for signaling visitor consent to registered ad tech vendors. OptSens runs a full __tcfapi implementation and encodes a TC string per purpose, per vendor, and per legitimate interest.

What OptSens does on the wire

OptSens installs window.__tcfapi early as a stub, then upgrades it to loaded once the vendor configuration arrives. The API answers these commands:

CommandReturns
pingCMP status, GVL version, TCF policy version
getTCDataTC string plus per-purpose and per-vendor consent
getInAppTCDataSame data shaped for in-app use
addEventListenerLive updates as consent changes
removeEventListenerDetaches a listener
getVendorListThe vendors, purposes, and features in use

A __tcfapiLocator iframe is created to let vendors in cross-domain frames reach the API. The TC string is also written to the euconsent-v2 cookie on the root domain.

An initial TC string is generated as soon as the CMP loads, with disclosed vendors set and all consents false (legitimate interest defaults active). After the visitor acts, OptSens re-encodes the string with their purpose, vendor, special feature, and legitimate-interest choices, and notifies all listeners.

When the framework runs alongside Google AC, the AC string is carried in the addtlConsent field of the TCData.

Vendor list (GVL) handling

OptSens hosts the Global Vendor List on its own infrastructure, as the TCF policy requires, and never loads it from the IAB CDN in the visitor's browser. The list refreshes weekly. The TC string is built from the vendors you select for your domain, with all purpose, feature, and stack text rendered exactly as IAB publishes it. If the TCF policy version or your vendor selections change, existing consents are invalidated and visitors are asked to consent again. See vendors.

How to enable it

IAB TCF requires a Plus plan or higher.

  1. Open the dashboard and select your domain.
  2. Go to Frameworks.
  3. Toggle IAB TCF v2.3.
  4. Save, then open Vendors to select your IAB vendors.
  5. Set your publisher country, encoded as the publisher country code in the TC string.

During onboarding, the frameworks step offers the same toggle, pre-selected when your plan includes it, and the IAB vendors step covers the vendor selection.

IAB TCF mode is served only to regions where it applies, based on your geo rules.

How to verify it

Open your site from a region your geo rules serve in IAB TCF mode, then run this in the browser console:

window.__tcfapi('ping', 2, function (ping) {
console.log(ping);
});

The call itself returns undefined in the console. The result is the logged object on the next line, where cmpStatus should read loaded. To read the current TC string and consent detail:

window.__tcfapi('getTCData', 2, function (tcData, success) {
console.log(success, tcData);
});

tcData.tcString holds the encoded string, and tcData.purpose.consents and tcData.vendor.consents hold the per-purpose and per-vendor detail.

If the console reports that window.__tcfapi is not a function, the page is not running in IAB TCF mode. Check that the framework is enabled and that your geo rules serve IAB TCF to the region you are testing from.