consent object. Which signals you send depends on where the user is:
Read the values from your consent management platform (CMP) and from the user’s browser or device. Send them exactly as you got them. Don’t build or edit consent strings yourself. The official SDKs read most of these signals for you (see What each SDK reads for you).
Why the signals are required
You can lose partner demand. Some demand partners decline to bid on requests that don’t carry valid privacy signals. A request with no signals competes for less demand, so it tends to fill less often and at a lower price. Gravity serves contextual-only ads when the signals say so. WhengdprApplies is true and the request has no valid tcfString, or when usPrivacy, gpp, or gpc opts the user out, the engine serves contextual-only ads: it matches the ad to the conversation and processes no user identifiers for that request. Ads still serve, because contextual matching needs no personal data. By default, the engine also treats a request that has no consent signal and comes from an EU, EEA, or UK location as having no consent, and serves contextual-only ads. A request from a browser that sends Sec-GPC: 1 is treated as gpc: true.
Sending the signals doesn’t stop ads when the user consents. A user who has consented, or who hasn’t opted out, gets the same ads as before. For the exact rules that the engine applies to each field, see Consent in the API reference.
The fields
What each SDK reads for you
Thegpp, gppSid, and gpc fields, and automatic GPP and GPC reading, need these minimum versions: @gravity-ai/api 1.5.0, gravity-sdk (Python) 0.6.0, GravitySDK (iOS) 1.3.0, and ai.trygravity:gravity-sdk (Android) 1.4.0. Earlier versions read only TCF and US Privacy. With an earlier version, send GPP and GPC with a direct HTTP request.
An explicit
consent value replaces what the SDK detects as a whole. The SDK doesn’t merge fields, so include every signal you have. In Python, an explicit consent= replaces gravity_context.consent from the client, and a Sec-GPC: 1 header still adds gpc: true.
The SDKs send only the signals they find. If your app or page has no IAB CMP, the request carries no TCF or GPP signal, and you must pass the values yourself.
Examples
Each example sends a US user’s signals. For an EU, EEA, or UK user, sendgdprApplies: true and tcfString instead.
consent object looks like this:
Check your integration
- Open your page or app with your CMP active, and accept or reject consent.
- Inspect the ad request body, or the
gravity_contextyour client posts, and confirm thatconsentholds the fields in the table at the top of this page. - Repeat for a user in each region you serve. A US user needs
gpp(orusPrivacy), andgpcwhen the browser or device sends it. An EU, EEA, or UK user needsgdprAppliesandtcfString.