Skip to content

Commit 7167d04

Browse files
bkboothclaude
andcommitted
docs(pixel): clarify no failure callback for CMP auto-detection
Make it explicit that there is no callback when CMP detection times out, and show a setTimeout-based fallback pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d6906ff commit 7167d04

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/audience/pixel/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ The pixel starts in `none` and checks for these CMP standards (in priority order
5454
1. [**Google Consent Mode v2**](https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced) — reads `analytics_storage` and `ad_storage` from `window.dataLayer`
5555
2. [**IAB TCF v2**](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md) — reads purpose consents via `window.__tcfapi`
5656

57-
Once a CMP is detected, the pixel upgrades consent automatically and continues listening for changes (e.g. when a user updates their cookie preferences). If no CMP is detected after a few seconds, the pixel remains in `none`. You can provide a manual fallback:
57+
Once a CMP is detected, the pixel upgrades consent automatically and continues listening for changes (e.g. when a user updates their cookie preferences). If no CMP is detected after ~2.5 seconds, the pixel remains in `none` silently (there is no failure callback). If your CMP may not be present on every page, push a manual fallback on your own timeout:
5858

5959
```javascript
60-
// Manual fallback if no CMP is present
61-
window.__imtbl.push(['consent', 'anonymous']);
60+
setTimeout(function() {
61+
window.__imtbl.push(['consent', 'anonymous']);
62+
}, 3000);
6263
```
6364

6465
### Updating consent at runtime

0 commit comments

Comments
 (0)