Info
Beschrijving

Google Consent Mode v2 Ondersteuning voor inApp SDK's

BELANGRIJK: Van versie 3.3.0 verder hebben we geïmplementeerd de automatische update van Firebase Consent Mode Status, via introspectieOnze CMP SDK detecteert automatisch of uw app Firebase integreert, en zal automatisch de setConsent() methode van Firebase om de toestemmingen bij te werken via introspectie/reflectie, tenzij u dit gedrag uitschakelt met de methode setAutomaticConsentUpdatesEnabled(false)Controleer de onderstaande codefragmenten en kies de strategie die het beste bij uw use case past. Zorg ervoor dat u NIET toestaat dat onze SDK automatisch toestemming instelt EN OOK de setConsent()-methode van Firebase in uw code aanroept, aangezien dubbele signalen gegarandeerd onvoorspelbare resultaten opleveren. 

Op zoek naar een CMP die de toestemmingsmodus van Google ondersteunt? Zie onze Google-toestemmingsmodus v2 productpagina.

Deze handleiding biedt instructies voor het integreren van de Google-toestemmingsmodus met de aangepaste modus ConsentManager in uw Android- of iOS-applicatie.

Voorwaarden

  • Zorg ervoor dat de toestemmingsmodus is ingeschakeld (Menu > CMP's > Integraties > Google-toestemmingsmodus)
  • Zorg ervoor dat Google Analytics, Google Ads of de andere Google-services in uw leverancierslijst staan
  • Een Firebase-project waarvoor Google Analytics is ingeschakeld.
  • Firebase SDK geïntegreerd in uw iOS-project.
  • CMPManager instellen in uw project.

Overzicht

Standaard controleert onze CMP mobiele SDK vanaf v3.3.0 automatisch of uw mobiele app Firebase integreert en roept de setConsent()-methode van Firebase aan via introspectie/reflectie om het voor onze klanten gemakkelijker te maken om de toestemmingen van uw CMP naar Firebase te propageren. Controleer de onderstaande code en zorg ervoor dat u: 

analytics = Firebase.analytics

val urlConfig = UrlConfig(
	id = "YOUR_CODE_ID",
	domain = "delivery.consentmanager.net",
	language = "EN",
	appName = "YourAppName"
)

cmpManager = CMPManager.getInstance(
    context = this,
    urlConfig = urlConfig,
    webViewConfig = webViewConfig,
    delegate = this
)

// IMPORTANT: This line below disables automatic propagation of GCM consent to Firebase
//            The default is TRUE, so if you suppress the line below, automatic
//            propagation WILL happen. If set to false like below, you'll need to MANUALLY invoke
//			  Firebase's setConsent() method, like demonstrated below.
cmpManager.setAutomaticConsentUpdatesEnabled(enabled = false)

cmpManager.setActivity(this)

cmpManager.checkAndOpen(false) { result ->
    result.onSuccess {
        navigateToHomeScreen()
    }.onFailure { error ->
        Log.e("DemoApp", "Check and open consent layer failed with error: $error")
    }

// Manual propagation of the consents to Firebase. You DO NOT need to do this
// if you .setAutomaticConsentUpdatesEnabled(true)
val firebaseConsent = cmpManager.getGoogleConsentModeStatus()    
firebaseAnalytics.setConsent(firebaseConsent)

iOS Handmatige propagatie naar Firebase

/// Synchronizes the consent status from CMP to Firebase Analytics
func syncConsentToFirebase() {
	let consentMode = CMPManager.shared.getGoogleConsentModeStatus()
	FirebaseConsentService.shared.updateFirebaseConsent(consentMode: consentMode)
}

 

Terug naar boven