# IAB frameworks

### Transparency and Consent Framework

Didomi is a registered CMP (ID 7) with the IAB Europe. We fully support the CMP API and your vendors will automatically use the `__tcfapi` function that we expose to collect user consent.

For this integration to behave properly, make sure that you include the IAB CMP stub at the top of your page:

```javascript
(function(){function r(e){if(!window.frames[e]){if(document.body&&document.body.firstChild){var t=document.body;var n=document.createElement("iframe");n.style.display="none";n.name=e;n.title=e;t.insertBefore(n,t.firstChild)}else{setTimeout(function(){r(e)},5)}}}function e(n,o,a,c,d){function e(e,t,n,r){if(typeof n!=="function"){return}if(!window[o]){window[o]=[]}var i=false;if(d){i=d(e,r,n)}if(!i){window[o].push({command:e,version:t,callback:n,parameter:r})}}e.stub=true;e.stubVersion=2;function t(r){if(!window[n]||window[n].stub!==true){return}if(!r.data){return}var i=typeof r.data==="string";var e;try{e=i?JSON.parse(r.data):r.data}catch(t){return}if(e[a]){var o=e[a];window[n](o.command,o.version,function(e,t){var n={};n[c]={returnValue:e,success:t,callId:o.callId};if(r.source){r.source.postMessage(i?JSON.stringify(n):n,"*")}},o.parameter)}}if(typeof window[n]!=="function"){window[n]=e;if(window.addEventListener){window.addEventListener("message",t,false)}else{window.attachEvent("onmessage",t)}}}e("__tcfapi","__tcfapiBuffer","__tcfapiCall","__tcfapiReturn");r("__tcfapiLocator");(function(e){var t=document.createElement("link");t.rel="preconnect";t.as="script";var n=document.createElement("link");n.rel="dns-prefetch";n.as="script";var r=document.createElement("script");r.id="spcloader";r.type="text/javascript";r["async"]=true;r.charset="utf-8";var i="{{SDK-URL}}"+e+"/loader.js?target="+document.location.hostname;if(window.didomiConfig&&window.didomiConfig.user){var o=window.didomiConfig.user;var a=o.country;var c=o.region;if(a){i=i+"&country="+a;if(c){i=i+"&region="+c}}}t.href="{{SDK-URL}}";n.href="{{SDK-URL}}";r.src=i;var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(t,d);d.parentNode.insertBefore(n,d);d.parentNode.insertBefore(r,d)})("{{Your-API-Key}}")})();
```

{% hint style="info" %}
This stub is automatically added to your Embed code available in the [Didomi Console](https://console.didomi.io/).
{% endhint %}

For the stub to behave properly, it should be added at the top of the `<head>` section, before any other script. Improperly placing the stub on your pages will reduce the effective consent rate seen by your IAB vendors and can impact your ad revenue negatively.

​[Read more in the IAB documentation](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#how-does-the-cmp-provide-the-api)

### Global Privacy Platform (GPP)

The [Global Privacy Platform (GPP) ](https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/tree/main/Core)string encapsulates user privacy preferences across multiple jurisdictions and frameworks. To learn more about Didomi's GPP integration read our [help center documentation](https://support.didomi.io/what-is-iab-gpp-framework).

By decoding the GPP string, you will have access to detailed information about user preferences across regulations, including:

* Applicable strings (e.g. TCF, USCA, USNAT, etc.)
* User's preferences related to the applicable data processing per regulation.

Similar to the TCF framework, ensure that the [GPP stub](https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Core/CMP%20API%20Specification.md#using-the-cmp-api) is included at the top of your webpage. This stub is automatically added to your Embed code available in the [Didomi Console](https://console.didomi.io/).

#### Fetching GPP string

* Using IAB's [\_\_gpp function](https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Core/CMP%20API%20Specification.md).
* You can also retrieve the GPP string directly through the Didomi SDK using the following method:

```javascript
Didomi.getCurrentUserStatus().gpp_string
```

Here is an example of GPP string: `DBABBg~BqoIAAKU.QA`

#### Decoding GPP string

Decode and interpret the GPP string using the [IAB GPP Decoder](https://iabgpp.com/#DBABBg~BqoIAAKU.QA).\
![](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-51ae93fbe2a83271c5e1501ebd1e96952f07e5eb%2Fimage.png?alt=media)
