medium · M6 · MASVS-PRIVACY-1 · PTKD-DS-ADS-BEFORE-CONSENT
Ads start before the user's consent (text search)
An ads SDK is initialized at app start, either with no consent SDK (UMP or another CMP) in the app, or before the consent form runs. Google's EU User Consent Policy and the GDPR require consent before personalized ads load in the EEA and UK.
How it is exploited
Not an attack: MobileAds.initialize() runs in Application.onCreate and the first banner requests personalized ads before the consent form has shown. For users in the EEA and UK that is personal-data processing without consent.
Why it matters
Google can limit or stop ad serving under its EU User Consent Policy, Play can act on the app, and data protection authorities can fine under GDPR.
How to fix it
- Add Google's User Messaging Platform (or a certified CMP) and request consent info on every launch.
- Show the form when required, and only then initialize the ads SDK when canRequestAds() is true.
- Give users a way to change their choice later (a 'Privacy options' entry in Settings).
Kotlin (UMP)
val ci = UserMessagingPlatform.getConsentInformation(this)
ci.requestConsentInfoUpdate(this, ConsentRequestParameters.Builder().build(), {
UserMessagingPlatform.loadAndShowConsentFormIfRequired(this) {
if (ci.canRequestAds()) MobileAds.initialize(this)
}
}, { /* log, keep ads off */ })Does your app have this?
PTKD checks your build or your source project for PTKD-DS-ADS-BEFORE-CONSENT and every other check in this knowledge base.
Scan your appReferences
Related checks (M6)
- PII in a response over a cacheable/first-party channel
- Supabase view in the public schema exposes auth.users
- Device/user PII sent to a third party
- Google Play restricted or sensitive permission
- Privacy manifest has invalid keys or values
- Missing Apple privacy manifest (PrivacyInfo.xcprivacy)
- Required-reason API used without a declared reason
- Third-party tracker not disclosed in the privacy manifest