Skip to content

Commit

Permalink
Update README.md - add DMA support
Browse files Browse the repository at this point in the history
  • Loading branch information
morisgateno-appsflyer authored Mar 7, 2024
1 parent 607eb79 commit f56b368
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ In order for us to provide optimal support, we would kindly ask you to submit an
- [setCurrentDeviceLanguage](#currentLang) *(ios only)*
- [setSharingFilterForPartners](#SharingFilterForPartners)
- [setDisableNetworkData](#disableNetworkID) *(android only)*
- [Send consent for DMA compliance](#dma_support)


### <a id="plugin-build-for"> This plugin is built for
Expand Down Expand Up @@ -804,3 +805,91 @@ In v6 of AppsFlyer SDK there are some api breaking changes:

### iOS
on iOS you need to implement IDFA request pop up and add AppTrackTransparency framework in order for the plugin to work


## <a id="dma_support"> Send consent for DMA compliance
For a general introduction to DMA consent data, see [here](https://dev.appsflyer.com/hc/docs/send-consent-for-dma-compliance).<be>
The SDK offers two alternative methods for gathering consent data:<br>
- **Through a Consent Management Platform (CMP)**: If the app uses a CMP that complies with the [Transparency and Consent Framework (TCF) v2.2 protocol](https://iabeurope.eu/tcf-supporting-resources/), the SDK can automatically retrieve the consent details.<br>
<br>OR<br><br>
- **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 <code>SharedPreferences</code>(Android) or <code>NSUserDefaults</code>(iOS). To enable the SDK to access this data and include it with every event, follow these steps:<br>
<ol>
<li> Call <code>AppsFlyerX::enableTCFDataCollection(true)</code> to instruct the SDK to collect the TCF data from the device.
<li> Set the the adapter to be manual(see (#manual-start)[manual mode]). <br> This will allow us to delay the Conversion call to provide the SDK with the user consent.
<li> Use the CMP to decide if you need the consent dialog in the current session.
<li> If needed, show the consent dialog, using the CMP, to capture the user consent decision. Otherwise, go to step 6.
<li> Get confirmation from the CMP that the user has made their consent decision, and the data is available in <code>SharedPreferences</code> or <code>NSUserDefaults</code>.
<li> Call start the following way:

```
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerX::setManualStart(false);
#endif
AppsFlyerX::start();
```
</ol>

#### AppDelegate
``` cpp
bool AppDelegate::applicationDidFinishLaunching() {

AppsFlyerX::stop(false);
AppsFlyerX::enableTCFDataCollection(true);
AppsFlyerX::setIsDebug(true);
AppsFlyerX::setAppsFlyerDevKey("devkey");

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// In case you want to use manual mode.
AppsFlyerX::setManualStart(true);
//
AppsFlyerX::setAppleAppID("appleAppId");
```
#### Scene class
- after getting CMP results
```cpp
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerX::setManualStart(false);
#endif
AppsFlyerX::start();
```


### 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.
<ol>
<li> Initialize <code>AppsFlyerX</code> using manual mode. This will allow us to delay the Conversion call in order to provide the SDK with the user consent.
<li> Determine whether the GDPR applies or not to the user.<br>
- If GDPR applies to the user, perform the following:
<ol>
<li> Given that GDPR is applicable to the user, determine whether the consent data is already stored for this session.
<ol>
<li> If there is no consent data stored, show the consent dialog to capture the user consent decision.
<li> If there is consent data stored continue to the next step.
</ol>
<li> To transfer the consent data to the SDK create an object called <code>AppsFlyerXConsent</code> using the <code>forGDPRUser()</code> method with the following parameters:<br>
- <code>hasConsentForDataUsage</code> - Indicates whether the user has consented to use their data for advertising purposes.<br>
- <code>hasConsentForAdsPersonalization</code> - Indicates whether the user has consented to use their data for personalized advertising purposes.
<li> Call <code>AppsFlyerX::setConsentData()</code> with the <code>AppsFlyerXConsent</code> object.
<li> Call start:
<code>
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerX::setManualStart(false);
#endif
AppsFlyerX::start();
</code>
</ol><br>
- If GDPR doesn’t apply to the user perform the following:
<ol>
<li> Create an <code>AppsFlyerXConsent</code> object using the <code>forNonGDPRUser()</code> method. This method doesn’t accept any parameters.
<li> Call <code>AppsFlyerX::setConsentData()</code> with the <code>AppsFlyerXConsent</code> object.
<li> Call start:
<code>
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerX::setManualStart(false);
#endif
AppsFlyerX::start();
</code>
</ol>
</ol>

0 comments on commit f56b368

Please sign in to comment.