TCF Check: How to Verify if TCF is Active

Learn how to check if TCF is enabled and how to extract information from the TCF string.

Justus Blümer

Justus Blümer

owntag Founder

published May 7, 2025

This is a little service article designed to make it as easy as possible for you to check whether and how TCF (the Transparency and Consent Framework) is active on a website.
Maybe you’re currently working on your Consent Management Platform (CMP) setup and want to verify whether your changes to implement TCF were successful.

TCF Check

To check whether TCF is active, you can paste the following code into your browser’s console and press Enter.
Open your browser’s developer tools (F12 on Windows, cmd + alt + i on Mac, or right-click -> “Inspect” in Google Chrome) and go to the “Console” tab.

javascript
// Execute in your browser's JS console
(function () {
  /* 1.  Is a TCF CMP present? */
  if (typeof window.__tcfapi !== 'function') {
    console.warn('⚠️  No __tcfapi on this page – either no CMP, it is still booting, or the site only exposes GPP (__gpp).');
    return;
  }

  /* 2.  Ping the CMP for basic status ...................................... */
  __tcfapi('ping', 2, (ping, ok) => { 
    if (!ok) { console.error('ping failed'); return; }

    console.table(ping);                // inspect cmpStatus, gdprApplies …
    if (ping.tcfPolicyVersion >= 4) {
      console.log(`✅ CMP runs TCF 2.2 (policy v${ping.tcfPolicyVersion})`);
    } else {
      console.log(`ℹ️ CMP is on policy v${ping.tcfPolicyVersion} (TCF 2.0/2.1)`);
    }

    /* 3.  Get the full TCData once the string is loaded .................... */
    __tcfapi('getTCData', 2, (tc, ok) => {
      if (!ok) { console.error('getTCData failed'); return; }

      /* —— NEW: show the raw consent (TC) string —— */
      console.log('📜 TCF consent string:', tc.tcString);

      /* ——— vendor IDs the user has consented to ——— */
      const consentedIds = Object.entries(tc.vendor.consents)
                                 .filter(([, yes]) => yes)
                                 .map(([id]) => +id);

      console.log('🟢 Vendor IDs with consent:', consentedIds);

      /* 4.  (optional) Map IDs ➜ readable names by pulling the vendor list */
      __tcfapi('getVendorList', 2, (gvl, ok) => {
        if (!ok) { console.warn('Could not retrieve Global Vendor List'); return; }

        const withNames = consentedIds.map(id => ({
          id,
          name: gvl.vendors[id]?.name || '(unknown)'
        }));
        console.table(withNames);
      }, 'LATEST');
    });
  });
})();
Show all code

The TCF String

The central element of TCF is the TCF string. It is created by the Consent Management Platform (CMP) and sent to the user’s browser.

You can find the TCF string after running the code above, under 📜 TCF consent string:. It will look something like this:

📜 TCF consent string: CQEbF4AQEbF4ABwABCENBFFgAP_gAEPgAAYgJ2tB5C5cSSFAIHp1YJtgMIUXwRAAwIAgBgAAA4ABgBKQIIQGEEEiJACIACACAAIAIAIAIAAAEAAAAEAAYIAFAAAAAEAAAAAAIAAAAAABAAAAAAAIAAAAEAAAgAAEAAAAgAAAAJIAAAAAAAAAAAAAAAAEAAAAAgAAAAAAQAAAAAAAgCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIG0QEwAFAAXABIAEcARwAnAB3AEIAIiARwAlIBNAC6gGvAO2AmIBggDFgG0ADhICwACwAKgAcAA8ACCAGQAaABEACYAFUAPQAfgBCACOAHcAPYAfsBIgElAJ-AcQBR4C2AF5joDYACwAKgAcABBADIANAAiABMACqAGIAPQAfgBOACjAGiAO4AewA_QCLQEiASUAn4BxADqAKPAWwAvMB_YE7SEAkABYAVQAxAB6AEcAO4AlIB1AH9koBgACwAOABEACYAFUAMQAjgBRgHUAUeAtgBeZSAoAAsACoAHAAQQAyADQAIgATAApABVADEAH4AUYA0QB-gEWgJEAkoB1AFsALzAf2VAAgAKLQAQB3AAA.YAAAAAAAAAAA

You can decode this encoded consent string using the tool at https://iabtcf.com/#/decode

… and access the information stored within it.

Become a Server Side Tagging Pro with owntag

Take control of your digital data collection with Server Side Tagging and Server Side GTM – easily hosted with owntag.

App screenshot