Skip to content

Commit

Permalink
DMA feature readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit kremer committed Feb 15, 2024
1 parent aca472b commit 70671fc
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 0 deletions.
58 changes: 58 additions & 0 deletions Docs/RN_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ The list of available methods for this plugin is described below.
- [addPushNotificationDeepLinkPath](#addpushnotificationdeeplinkpath)
- [appendParametersToDeepLinkingURL](#appendparameterstodeeplinkingurl)
- [disableAdvertisingIdentifier](#disableAdvertisingIdentifier)
- [enableTCFDataCollection](#enableTCFDataCollection)
- [setConsentData](#setConsentData)
- [setNonGDPRUser](#setNonGDPRUser)
- [Android Only APIs](#android-only-apis)
- [setCollectAndroidID](#setcollectandroidid)
- [setCollectIMEI](#setcollectimei)
Expand Down Expand Up @@ -750,6 +753,61 @@ Disables collection of various Advertising IDs by the SDK.<br>
appsFlyer.disableAdvertisingIdentifier(true);
```

---
### enableTCFDataCollection
`enableTCFDataCollection(enabled): void`

instruct the SDK to collect the TCF data from the device.


| parameter | type | description |
| ---------- |----------|------------------ |
| enabled | boolean | enable/disable TCF data collection |

*Example:*

```javascript
appsFlyer.enableTCFDataCollection(true);
```

---
### setConsentData
`setConsentData(consentData): void`

When GDPR applies to the user and your app does not use a CMP compatible with TCF v2.2, use this API to provide the consent data directly to the SDK.<br>
The consent object has 2 properties:

1. `hasConsentForDataUsage`: Indicates whether the user has consented to use their data for advertising purposes.
2. `hasConsentForAdsPersonalization`: ndicates whether the user has consented to use their data for personalized advertising.

| parameter | type | description |
| ---------- |----------|------------------ |
| consentData | object | Consent object of the user |

*Example:*

```javascript
let consentData = {
hasConsentForDataUsage: true,
hasConsentForAdsPersonalization: false
}

appsFlyer.setConsentData(consentData);
```

---

### setNonGDPRUser
`setNonGDPRUser(): void`

Use this API if GDPR doesn’t apply to the user.<br>

*Example:*

```javascript
appsFlyer.setNonGDPRUser();
```

## Android Only APIs

### setCollectAndroidID
Expand Down
136 changes: 136 additions & 0 deletions Docs/RN_CMP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
title: Send consent for DMA compliance
category: 5f9705393c689a065c409b23
parentDoc: 645213236f53a00d4daa9230
order: 12
hidden: false
---

## Send consent for DMA compliance
The SDK offers two alternative methods for gathering consent data:

Through a Consent Management Platform (CMP): If the app uses a CMP that complies with the Transparency and Consent Framework (TCF) v2.2 protocol, the SDK can automatically retrieve the consent details.

OR

Through a dedicated SDK API: Developers can pass Google's required consent data directly to the SDK using a specific API designed for this purpose.

### Use CMP to collect consent data
A CMP compatible with TCF v2.2 collects DMA consent data and stores it in NSUserDefaults (iOS) and SharedPreferences (Android). To enable the SDK to access this data and include it with every event, follow these steps:

1. Call `appsFlyer.enableTCFDataCollection(true)`
2. Initialize the SDK in [manual start mode](/Docs/RN_API.md#initsdk)
3. Use the CMP to decide if you need the consent dialog in the current session to acquire the consent data. If you need the consent dialog move to step 4; otherwise move to step 5
4. Get confirmation from the CMP that the user has made their consent decision and the data is available in NSUserDefaults/SharedPreferences
5. Call `appsFlyer.startSdk()`
```javascript
useEffect(() => {
const option = {
isDebug: true,
devKey: 'UxXxXxXxXd',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 10,
manualStart: true, // <-- Manual start
};
// TCF data collection
appsFlyer.enableTCFDataCollection(true);

//init appsflyer
appsFlyer.initSdk(
option,
res => {
console.log(res);
},
err => {
console.log(err);
},
);

...

// CMP Pseudocode
if (cmpManager.hasConsent()) {
appsFlyer.startSdk();
} else {
cmpManager.presentConsentDialog(res => {
appsFlyer.startSdk();
});
}
},[])
```
## Manually collect consent data
If your app does not use a CMP compatible with TCF v2.2, use the SDK API detailed below to provide the consent data directly to the SDK.

### When GDPR applies to the user
If GDPR applies to the user, perform the following:

1. Given that GDPR is applicable to the user, determine whether the consent data is already stored for this session.
1. If there is no consent data stored, show the consent dialog to capture the user consent decision.
2. If there is consent data stored continue to the next step.
2. To transfer the consent data to the SDK create a JSON with the following parameters:<br>
`hasConsentForDataUsage` - Indicates whether the user has consented to use their data for advertising purposes.<br>
`hasConsentForAdsPersonalization` - Indicates whether the user has consented to use their data for personalized advertising.
3. Call `appsFlyer.setConsentData({})` with the JSON.
4. Call `appsFlyer.initSdk()`.
```javascript
useEffect(() => {
const option = {
isDebug: true,
devKey: 'UxXxXxXxXd',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 10,
};

// user consent data
let consentData = {
hasConsentForDataUsage: true/false,
hasConsentForAdsPersonalization: true/false
}

appsFlyer.setConsentData(consentData);

//start appsflyer
appsFlyer.initSdk(
option,
res => {
console.log(res);
},
err => {
console.log(err);
},
);
},[])
```
### When GDPR does not apply to the user

If GDPR doesn’t apply to the user perform the following:

1. Call `appsFlyer.setNonGDPRUser()`.
2. Call `appsFlyer.initSdk()`.
```javascript
useEffect(() => {
const option = {
isDebug: true,
devKey: 'UxXxXxXxXd',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 10,
};

// GDPR does not apply to the user
appsFlyer.setNonGDPRUser()

//start appsflyer
appsFlyer.initSdk(
option,
res => {
console.log(res);
},
err => {
console.log(err);
},
);
},[])
```
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ If you have used 1 of the removed APIs, please check the integration guide for t
- [Test integration](/Docs/RN_Testing.md)
- [In-app events](/Docs/RN_InAppEvents.md)
- [Uninstall measurement](/Docs/RN_UninstallMeasurement.md)
- [Send consent for DMA compliance](/Docs/RN_CMP.md)
## 🔗 Deep Linking
- [Integration](/Docs/RN_DeepLinkIntegrate.md)
- [***Expo*** Integration](/Docs/RN_ExpoDeepLinkIntegration.md)
Expand Down

0 comments on commit 70671fc

Please sign in to comment.