AppsFlyerConsent

Overview

AppsFlyerConsent encapsulates the properties for acquiring consent data required by the Digital Marketing Act (DMA) and GDPR compliance.

public struct AppsFlyerConsent {
    public let isUserSubjectToGDPR: Bool
    public let hasConsentForDataUsage: Bool
    public let hasConsentForAdsPersonalization: Bool
    public let hasConsentForAdStorage: Bool
}

Parameters

NameTypeDescription
isUserSubjectToGDPRBooleanIndicates whether GDPR applies to the user.
hasConsentForDataUsageBooleanIndicates whether the user has consented to use their data for advertising purposes.
hasConsentForAdsPersonalizationBooleanIndicates whether the user has consented to use their data for personalized advertising.
hasConsentForAdStorageBooleanIndicates whether the user has consented to store or access data on a device.

Usage examples

Swift

// If the user is subject to DMA - collect the consent data
// or retrieve it from the storage

// Set the consent data to the SDK:
//  Example for a user subject to GDPR
var gdprUser = AppsFlyerConsent(
	isUserSubjectToGDPR: true, 
	hasConsentForDataUsage: false, 
	hasConsentForAdsPersonalization: true, 
	hasConsentForAdStorage: false
)
AppsFlyerLib.shared().setConsentData(gdprUser)

//  Example for a user not subject to GDPR        
var nonGdprUser = AppsFlyerConsent(
	isUserSubjectToGDPR: false, 
	hasConsentForDataUsage: false, 
	hasConsentForAdsPersonalization: false, 
	hasConsentForAdStorage: false
)
AppsFlyerLib.shared().setConsentData(nonGdprUser)

Initializers

initForGDPRUser

Deprecated since V6.16.1

Input arguments

TypeNameDescription
BooleanforGDPRUserWithHasConsentForDataUsageIndicates whether the user give consent to send their user data to Google.
BooleanhasConsentForAdsPersonalizationIndicates whether the user consented to use their data for personalized advertising.

Usage examples

// If the user is subject to DMA - collect the consent data
// or retrieve it from the storage

// Set the consent data to the SDK:
var gdprConsent = AppsFlyerConsent(forGDPRUserWithHasConsentForDataUsage: true, hasConsentForAdsPersonalization: true) 
AppsFlyerLib.shared().setConsentData(gdprConsent)

initForNonGDPRUser

Deprecated since V6.16.1

Input arguments

None

Usage examples

// If the user is not subject to DMA:
var nonGdprUser = AppsFlyerConsent(nonGDPRUser: ()) 
AppsFlyerLib.shared().setConsentData(nonGdprUser)