Consent forwarding
OptSens forwards each decision to Google Consent Mode and to attribution partners (AppsFlyer, Adjust, Branch, Kochava). Only the consent decision is forwarded; the partner SDKs are your own. Firebase is gated on the dashboard Consent Mode toggle. How the attribution partners receive the decision depends on the platform: automatically on Android, and through one small forwarder per partner on iOS (below).
- Android
- iOS / tvOS
Forwarding is automatic. The SDK detects Firebase and each attribution partner at runtime and forwards consent with no host code. An app without a given partner SDK does nothing for it.
- Firebase (Google Consent Mode): add
com.google.firebase:firebase-analyticsand thegoogle-servicesplugin as usual. Forwarded when the dashboard Consent Mode toggle is on. - AppsFlyer, Adjust, Branch, Kochava: forwarded automatically whenever the SDK is in the app.
You do not add any forwarder code on Android.
Firebase and Kochava are automatic: Firebase through the default forwarder (gated on the Consent Mode toggle), Kochava through the IAB string the SDK already writes. AppsFlyer, Adjust and Branch expose Swift-only consent APIs; add one forwarder per partner you use and compose them.
Add a forwarder for each partner:
import OptSensCore
import AppsFlyerLib
struct AppsFlyerConsentForwarder: ConsentForwarder {
func apply(_ signals: GcmSignals, gdprApplies: Bool, gcmEnabled: Bool) {
let v = ForwardingMappings.appsFlyer(signals, gdprApplies: gdprApplies)
AppsFlyerLib.shared().setConsentData(AppsFlyerConsent(
isUserSubjectToGDPR: NSNumber(value: v.isUserSubjectToGDPR),
hasConsentForDataUsage: NSNumber(value: v.hasConsentForDataUsage),
hasConsentForAdsPersonalization: NSNumber(value: v.hasConsentForAdsPersonalization),
hasConsentForAdStorage: NSNumber(value: v.hasConsentForAdStorage)))
}
}
import OptSensCore
import AdjustSdk
struct AdjustConsentForwarder: ConsentForwarder {
func apply(_ signals: GcmSignals, gdprApplies: Bool, gcmEnabled: Bool) {
guard let sharing = ADJThirdPartySharing(isEnabled: nil) else { return }
for o in ForwardingMappings.adjust(signals, gdprApplies: gdprApplies) {
sharing.addGranularOption("google_dma", key: o.key, value: o.value)
}
Adjust.trackThirdPartySharing(sharing)
}
}
import OptSensCore
import BranchSDK
struct BranchConsentForwarder: ConsentForwarder {
func apply(_ signals: GcmSignals, gdprApplies: Bool, gcmEnabled: Bool) {
let v = ForwardingMappings.branch(signals, gdprApplies: gdprApplies)
Branch.setDMAParamsForEEA(v.eeaRegion,
adPersonalizationConsent: v.adPersonalizationConsent,
adUserDataUsageConsent: v.adUserDataUsageConsent)
}
}
Compose the forwarders for the SDKs your app uses and pass them to configure.
CompositeConsentForwarder.automatic keeps Firebase automatic:
OptSens.configure(apiKey: "YOUR_SDK_ID",
options: OptSensOptions(consentForwarder: CompositeConsentForwarder([
CompositeConsentForwarder.automatic, // Firebase (automatic)
AppsFlyerConsentForwarder(), // only if the app uses AppsFlyer
AdjustConsentForwarder(), // only if the app uses Adjust
BranchConsentForwarder(), // only if the app uses Branch
])))
For Firebase to forward on iOS, Firebase Analytics must be loaded in your app, not only linked. A real app that uses Analytics satisfies this.
After a reject, Google Consent Mode still sends cookieless pings by design
(analytics_storage = denied means no identifiers, not silence). To send nothing
before consent, gate your own collection as well.