Skip to content

Commit ce72438

Browse files
committed
Update docs
1 parent fd16b4f commit ce72438

2 files changed

Lines changed: 97 additions & 57 deletions

File tree

Docs/RN_CMP.md

Lines changed: 96 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -59,81 +59,123 @@ A CMP compatible with TCF v2.2 collects DMA consent data and stores it in NSUser
5959
}
6060
},[])
6161
```
62-
## Manually collect consent data
63-
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.
64-
65-
### When GDPR applies to the user
66-
If GDPR applies to the user, perform the following:
67-
68-
1. Given that GDPR is applicable to the user, determine whether the consent data is already stored for this session.
69-
1. If there is no consent data stored, show the consent dialog to capture the user consent decision.
70-
2. If there is consent data stored continue to the next step.
71-
2. To transfer the consent data to the SDK create an AppsFlyerConsent object using `forGDPRUser` method that accepts the following parameters:<br>
72-
`hasConsentForDataUsage: boolean` - Indicates whether the user has consented to use their data for advertising purposes.<br>
73-
`hasConsentForAdsPersonalization: boolean` - Indicates whether the user has consented to use their data for personalized advertising.
74-
3. Call `appsFlyer.setConsentData(consentData)` with the AppsFlyerConsent object.
75-
4. Call `appsFlyer.initSdk()`.
62+
63+
### Manually Collecting Consent Data
64+
65+
If your app does not use a TCF v2.2-compatible CMP, you must manually provide the consent data using the SDK API.
66+
67+
How to Set Consent Data: </br>
68+
1. Determine GDPR Applicability:
69+
* If GDPR applies, check whether consent data is already stored.
70+
* If not stored, show a consent dialog to obtain user consent.
71+
2. Create an AppsFlyerConsent object with the relevant parameters.
72+
3. Pass the consent data to the SDK using appsFlyer.setConsentData(consentData).
73+
4. Initialize the SDK with appsFlyer.initSdk().
74+
75+
#### Setting Consent Data for Users
76+
77+
<b>When GDPR Applies</b>
78+
79+
If GDPR applies to the user, create an AppsFlyerConsent object with the user’s preferences.
7680
```javascript
77-
import appsFlyer, {AppsFlyerConsent} from 'react-native-appsflyer';
81+
import appsFlyer, { AppsFlyerConsent } from 'react-native-appsflyer';
7882

7983
useEffect(() => {
8084
const option = {
81-
isDebug: true,
82-
devKey: 'UxXxXxXxXd',
83-
onInstallConversionDataListener: true,
84-
onDeepLinkListener: true,
85-
timeToWaitForATTUserAuthorization: 10,
85+
isDebug: true,
86+
devKey: 'UxXxXxXxXd',
87+
onInstallConversionDataListener: true,
88+
onDeepLinkListener: true,
89+
timeToWaitForATTUserAuthorization: 10,
8690
};
8791

88-
// user consent data
89-
let consentData = AppsFlyerConsent.forGDPRUser(true, false);
92+
// User has given consent
93+
const consentData = new AppsFlyerConsent(true, true, true, true);
9094

95+
// Send consent data to the SDK
9196
appsFlyer.setConsentData(consentData);
9297

93-
//start appsflyer
98+
// Start AppsFlyer SDK
9499
appsFlyer.initSdk(
95-
option,
96-
res => {
97-
console.log(res);
98-
},
99-
err => {
100-
console.log(err);
101-
},
100+
option,
101+
res => console.log(res),
102+
err => console.log(err)
102103
);
103-
},[])
104+
}, []);
104105
```
105-
### When GDPR does not apply to the user
106106

107-
If GDPR doesn’t apply to the user perform the following:
108-
1. Create an AppsFlyerConsent object using `forNonGDPRUser` method that doesn't accepts any parameters
109-
2. Call `appsFlyer.setConsentData(consentData)` with the AppsFlyerConsent object.
110-
3. Call `appsFlyer.initSdk()`.
107+
<b>When GDPR Does Not Apply</b>
108+
109+
If GDPR does not apply to the user, simply mark it as such in the AppsFlyerConsent object.
111110
```javascript
112-
import appsFlyer, {AppsFlyerConsent} from 'react-native-appsflyer';
111+
import appsFlyer, { AppsFlyerConsent } from 'react-native-appsflyer';
113112

114113
useEffect(() => {
115114
const option = {
116-
isDebug: true,
117-
devKey: 'UxXxXxXxXd',
118-
onInstallConversionDataListener: true,
119-
onDeepLinkListener: true,
120-
timeToWaitForATTUserAuthorization: 10,
115+
isDebug: true,
116+
devKey: 'UxXxXxXxXd',
117+
onInstallConversionDataListener: true,
118+
onDeepLinkListener: true,
119+
timeToWaitForATTUserAuthorization: 10,
121120
};
122121

123122
// GDPR does not apply to the user
124-
let consentData = AppsFlyerConsent.forNonGDPRUser();
123+
const consentData = new AppsFlyerConsent(false);
125124

126-
appsFlyer.setConsentData(consentData);
125+
// Send consent data to the SDK
126+
appsFlyer.setConsentData(consentData);
127127

128-
//start appsflyer
128+
// Start AppsFlyer SDK
129129
appsFlyer.initSdk(
130-
option,
131-
res => {
132-
console.log(res);
133-
},
134-
err => {
135-
console.log(err);
136-
},
130+
option,
131+
res => console.log(res),
132+
err => console.log(err)
137133
);
138-
},[])
139-
```
134+
}, []);
135+
```
136+
137+
### Consent Object API
138+
139+
```javascript
140+
//AppsFlyerConsent Constructor:
141+
142+
new AppsFlyerConsent(
143+
isUserSubjectToGDPR, // Boolean (optional) - Whether GDPR applies to the user
144+
hasConsentForDataUsage, // Boolean (optional) - Consent for data usage
145+
hasConsentForAdsPersonalization, // Boolean (optional) - Consent for ads personalization
146+
hasConsentForAdStorage // Boolean (optional) - Consent for ad storage
147+
);
148+
149+
//Example Cases:
150+
151+
// Full consent for GDPR user
152+
const consent1 = new AppsFlyerConsent(true, true, true, true);
153+
154+
// No consent for GDPR user
155+
const consent2 = new AppsFlyerConsent(true, false, false, false);
156+
157+
// Non-GDPR user
158+
const consent3 = new AppsFlyerConsent(false);
159+
160+
// AppsFlyerConsent object support the following cases if they are needed.
161+
const consent4 = new AppsFlyerConsent(true);
162+
const consent5 = new AppsFlyerConsent(true, true);
163+
const consent6 = new AppsFlyerConsent(null, true, true, true);
164+
const consent7 = new AppsFlyerConsent(true, null, true, true);
165+
const consent8 = new AppsFlyerConsent(true, true, null, true);
166+
const consent9 = new AppsFlyerConsent(true, true, true, null);
167+
const consent10 = new AppsFlyerConsent(true, true, false, true);
168+
const consent11 = new AppsFlyerConsent(false, true, false, false);
169+
const consent12 = new AppsFlyerConsent(null, null, null, null);
170+
const consent13 = new AppsFlyerConsent();
171+
```
172+
173+
### Deprecation Notice
174+
175+
The following methods have been deprecated since SDK version 6.16.2 and should no longer be used:
176+
```javascript
177+
// Deprecated since 6.16.2
178+
AppsFlyerConsent.forGDPRUser(true, false);
179+
AppsFlyerConsent.forNonGDPRUser();
180+
```
181+
Instead, use the new AppsFlyerConsent constructor.

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
- Tested with React-Native **v0.62.0** (older versions might be supported)
1818

1919
## <a id="breaking-changes"> ❗❗ Breaking changes when updating to v6.x.x❗❗
20-
- Starting from version `6.16.2`, Android minimum SDK version is 21.
21-
<br/>Potential Build Issues: If you are using Android Gradle Plugin (AGP) below 8.2.0, you may encounter build errors on Android.
22-
<br/>To resolve this, refer to the [Android Build Error Due to AGP Version](./Docs/RN_Installation.md#android-build-error-due-to-agp-version).
20+
- From version `6.16.2`, `AppsFlyerConsent.forGDPRUser` and `AppsFlyerConsent.forNonGDPRUser` have been **deprecated**. Use the new `AppsFlyerConsent` constructor instead. See [Deprecation Notice](/Docs/RN_CMP.md#deprecation-notice).
2321

2422
- From version `6.15.1`, upgraded to targetSDKVersion 34, Java 17, and Gradle 8.7 in [AppsFlyer Android SDK v6.15.1](https://support.appsflyer.com/hc/en-us/articles/115001256006-AppsFlyer-Android-SDK-release-notes).
2523

0 commit comments

Comments
 (0)