Skip to content

Read GPP consent from the IAB's UserDefaults keys - #86

Merged
jrosendahl-opt merged 2 commits into
masterfrom
fix/gpp-sid-fallback
Oct 30, 2026
Merged

jrosendahl-opt merged 2 commits into
masterfrom
fix/gpp-sid-fallback

Conversation

@jrosendahl-opt

Copy link
Copy Markdown
Contributor

Why

The IAB GPP spec has in-app CMPs store the GPP string under IABGPP_HDR_GppString and the applicable section IDs under IABGPP_GppSID (underscore-separated, e.g. 2_7). The SDK read IABGPP_2_TCString, which isn't an IAB key, and never read the section IDs. With a spec-compliant CMP, no gpp was sent, and gpp_sid was never sent unless the app set config.gppSid.

What Changed

  • Source: IABConsent.gppTC reads IABGPP_HDR_GppString first and falls back to IABGPP_2_TCString, so apps that write the old key keep working.
  • Source: new IABConsent.gppSid reads IABGPP_GppSID and converts 2_7 to 2,7, the comma-separated form the Edge API takes (same as the web SDK and the Android docs).
  • Source: EdgeAPI.buildEdgeAPIURL uses the CMP's section IDs only when the GPP string also came from the CMP, as gdpr/gdprConsent are paired. An explicit config.gppSid still wins. A config.gpp without gppSid doesn't pick up the CMP's IDs, which may belong to a different string.
  • Source: OptableConfig doc comments for gpp/gppSid name the right keys and link the GPP spec.

How to Test

  • bundle exec fastlane tests passes (104 tests locally)
  • New/updated EdgeAPITests: spec keys give gpp + gpp_sid=2,7; the old key still works; an explicit config.gpp ignores the CMP's section IDs.

Notes

  • Apps with a spec-compliant CMP will now send gpp/gpp_sid where they sent nothing before.

  • Document OptableConfig options and consent signals #79 documents the old behavior (IABGPP_2_TCString, "no UserDefaults fallback" for gppSid). Its docs need updating once one of the two merges.

  • The Android SDK reads the same non-IAB IABGPP_2_TCString key.

  • Breaking change

  • Requires release

🤖 Generated with Claude Code

The SDK read the GPP string from IABGPP_2_TCString, which is not an IAB
key, so a spec-compliant CMP's string was never found. It never read the
section IDs either, so gpp went out without gpp_sid unless the app set it.

Read IABGPP_HDR_GppString (keeping IABGPP_2_TCString as a fallback) and
IABGPP_GppSID, converting the CMP's "2_7" to the Edge API's "2,7". The
CMP's section IDs are only used with the CMP's GPP string; an explicit
config.gppSid still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jrosendahl-opt
jrosendahl-opt merged commit d09ebca into master Oct 30, 2026
4 checks passed
@jrosendahl-opt
jrosendahl-opt deleted the fix/gpp-sid-fallback branch October 30, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants