All docs
Consent, TCF 2.2 and Google Consent Mode
How the Worksly tag and SDK read TCF 2.2 consent strings and Google Consent Mode signals, and how to set up defaults and testing.
If you serve users in the EEA or UK, Worksly requires a valid consent signal before it requests or serves personalized ads. Worksly integrates with consent management through the IAB TCF 2.2 framework and Google Consent Mode. This page shows what the tag and SDK read, the defaults to set on your pages, and how to verify the whole chain before launch.
How Worksly reads consent
On web, the Worksly tag reads the TCF 2.2 consent string from the __tcfapi function your consent management platform (CMP) registers on the page. No Worksly-specific consent script is added; we consume the standard signal. On mobile, the SDK reads the consent string your CMP SDK exposes through the standard shared storage location, or you can pass the string explicitly at initialization if your CMP requires it.
Worksly enforces purpose-level consent: advertising purposes 1, 2 and 4 as registered under TCF 2.2 determine whether personalized advertising is permitted, and a request without the required purposes still competes for limited-data demand where regulation and buyer policy allow it. What is never done: requesting ads without any consent signal from EEA/UK users. Your CMP choice is yours. Worksly works with any CMP registered on the IAB’s TCF list.
TCF 2.2: what the tag listens for
The tag calls getTCData and also registers for updates, so consent captured mid-session is honored immediately:
window.__tcfapi('getTCData', 2, function (tcData, success) {
if (!success) return;
// tcData.tcString is the encoded consent string Worksly reads.
// tcData.purpose.consents indicates which purposes the user granted.
window.workslyConsent = tcData.tcString;
});
window.__tcfapi('addEventListener', 2, function (tcData, success) {
if (!success) return;
if (tcData.eventStatus === 'tcloaded' ||
tcData.eventStatus === 'useractioncomplete') {
window.workslyConsent = tcData.tcString;
}
});
You do not need to write this code for Worksly’s benefit. It is shown so you can verify what a working CMP setup provides. If window.__tcfapi is undefined when the tag loads, or the string arrives after the auction has already started, requests go out without consent, which suppresses personalized demand for those impressions.
Google Consent Mode defaults
Set Consent Mode defaults before any Google tag loads, then update them when the user interacts with your CMP:
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
analytics_storage: 'denied'
});
All four flags start denied, giving your CMP a brief window to resolve before signals are sent. When the user makes a choice, update:
gtag('consent', 'update', {
ad_storage: 'granted',
ad_user_data: 'granted',
ad_personalization: 'granted',
analytics_storage: 'granted'
});
The mapping between TCF purposes and these flags is your CMP’s job on CMPs that support Google mode; if yours does not, keep the flags aligned with the purposes the user granted. Worksly reads the resulting signals so that GAM-side behavior (personalization, NPA) matches what the user chose.
The full chain, in order
A compliant page loads these in sequence:
- Consent Mode defaults (denied): before any Google or ad tag.
- Your CMP SDK, which registers
__tcfapiand shows the banner. - The Worksly tag, which reads
getTCDataand Consent Mode signals at request time. - Your ad server call, carrying consent into the auction.
On mobile the same steps run in your CMP SDK and the Worksly SDK; the SDK defers ad requests until a consent string is present.
Testing before launch
- In an EEA/UK-located test (or a browser profile configured for one), load a page and deny all purposes in the banner. Confirm in your network inspector that ad requests carry no consent string and that your dashboard traffic view shows them flagged accordingly.
- Accept purposes and reload. Confirm the request now carries the TCF string, and that
hb_bidderdelivery in GAM looks unchanged for consented traffic. - Grant and deny a few times within one session and confirm the
addEventListenerpath updates state without a reload. - On mobile, run the same deny/accept cycle with your CMP’s debug logging, and confirm the SDK defers requests in the denied case.
- Check your CMP’s vendor list includes Worksly as a registered vendor under TCF 2.2. A missing vendor entry means users cannot grant consent to us even if they intend to.
Consent enforcement is not optional in the EEA and UK. If your pages run ad tags before the CMP resolves, personalized demand is suppressed at best and your compliance posture is broken at worst. Test the deny path as carefully as the accept path.