NitroPay is bundled with our in-house IAB accredited Consent Management Platform (CMP) to collect privacy signals from users in the EU. The purposes and features are pre-selected for you in order to disclose everything necessary for online advertising.
We understand that some sites have their own data disclosures separate from this CMP. In an effort to reduce UI clutter from having multiple independent data processing popups at the same time, we’ve created an area within the CMP for our publishers (see: “Other disclosures” in fig. below)
Once your disclosures have been added in the panel to your site(s), you will likely want to access whether the current user has consented or not during their session at some point. This data is made available through a command added to the TCFv2 api.
argument name | type | expected value | description |
command | string | ‘hasCustomConsent’ | |
version | int | 2 | The current version of the TCF framework |
callback | function | function(result: boolean) | The first argument will be true if the user has consented |
consent id | int | The id of the custom consent you’re checking |
Here’s a basic example of it in action, where we created a custom consent with ID 3 and want to see if the user has opted into it.
<script type="text/javascript">
if (typeof window['__tcfapi'] == 'function') {
__tcfapi('hasCustomConsent', 2, (res) => {
if (res) {
// do something
}
}, 3);
}
</script>
Note: It’s important to check that the TCF API function exists before checking for consents (as demonstrated above). The API may not exist due to ad blockers, or the user being in a region outside of the EU.
Alternatively (if allowed by the user) consents are available as a cookie named ncmp-cc
containing all of the custom consent IDs that the user enabled as a comma delimited string.