An open API service indexing awesome lists of open source software.

https://github.com/appsflyersdk/appsflyer-adobe-mobile-android-extension

AppsFlyer Android SDK Extension for Adobe Mobile SDK
https://github.com/appsflyersdk/appsflyer-adobe-mobile-android-extension

Last synced: 10 months ago
JSON representation

AppsFlyer Android SDK Extension for Adobe Mobile SDK

Awesome Lists containing this project

README

          

# appsflyer-adobe-mobile-android-extension

πŸ›  In order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com

> *When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.*

## Table of content

- [Adding the SDK to your project](#add-sdk-to-project)
- [Initializing the SDK](#init-sdk)
- [Manual mode](#manual-mode)
- [Guides](#guides)
- [API](#api)
- [Data Elements](#data-elements)
- [Initializing the SDK](#init-sdk)
- [Send consent for DMA compliance](#send-consent-for-DMA-compliance)

### This plugin is built for

- Android AppsFlyer SDK **v6.13.0**

## πŸ“² Adding the SDK to your project

Add the following to your app's `build.gradle (Module: app)` file:

```groovy
repositories {
mavenCentral()
}

dependencies {
...
implementation 'com.appsflyer:appsflyer-adobe-sdk-extension:6.+'
implementation 'com.android.installreferrer:installreferrer:1.1'
}
```

> Add the installreferrer library to improve attribution accuracy, protects from install fraud and more.

## πŸš€ Initializing the SDK

Register the AppsFlyer extension from your `Application` class, alongside the Adobe SDK initialisation code:
```java
@Override
public void onCreate() {
super.onCreate();

MobileCore.setApplication(this);
MobileCore.setLogLevel(LoggingMode.DEBUG);
...
try {
...
AppsFlyerAdobeExtension.registerExtension();
...
}
}
```

In Addition to adding the init code, the settings inside the launch dashboard must be set.

| Setting | Description |
| -------- | ------------- |
| AppsFlyer iOS App ID | Your iTunes [application ID](https://support.appsflyer.com/hc/en-us/articles/207377436-Adding-a-new-app#available-in-the-app-store-google-play-store-windows-phone-store) (required for iOS only) |
| AppsFlyer Dev Key | Your application [devKey](https://support.appsflyer.com/hc/en-us/articles/211719806-Global-app-settings-#sdk-dev-key) provided by AppsFlyer (required) |
| Bind in-app events for | Bind adobe event to appsflyer in-app events. For more info see the doc [here](/docs/Guides.md#events). |
| Send attribution data | Send conversion data from the AppsFlyer SDK to adobe. This is required for data elements. |
| Debug Mode | Debug mode - set to `true` for testing only. |
| Wait for ECID | Once enabled, the SDK Initialization will be delayed until the Experience Cloud ID is set. |

> Note: For Send attribution data, use this feature if you are only working with ad networks that allow sharing user level data with 3rd party tools.

## Manual mode
Starting version `6.13.0`, we support a manual mode to seperate the initialization of the AppsFlyer SDK and the start of the SDK.
In this case, the AppsFlyer SDK won't start automatically, giving the developer more freedom when to start the AppsFlyer SDK.
Please note that in manual mode, the developer is required to implement the API `AppsFlyerLib.getInstance().start(Activity activity)` in order to start the SDK.
You should set this mode before registering the `MobileCore` Extensions in `Application`.

If you are using CMP to collect consent data this feature is needed. See explanation [here](#send-consent-for-DMA-compliance).
### Example:
```java
AppsflyerAdobeExtension.manual = true;
```
Please look at the example below to see how to start SDK once you want.
Keep in mind you shouldn't put the `start()` on a lifecycle method.
To start the AppsFlyer SDK, use the `start()` API, like the following :
```java
AppsFlyerLib.getInstance().start(this)
```

## πŸ“– Guides

- [Deep Linking](/docs/Guides.md#deeplinking)
- [In-App Events](/docs/Guides.md#events)
- [Data Elements](/docs/Guides.md#data-elements)
- [Attribution Data tracking with Adobe Analytics](/docs/Guides.md#attr-data)
- [Deeplink Data tracking with Adobe Analytics](/docs/Guides.md#deeplink-data)
- [Adobe Analytics](/docs/AdobeAnalytics.md)

## πŸ“‘ API

See the full [API](/docs/API.md) available for this plugin.

## πŸ“‚ Data Elements

Check out the available data elements [here](/docs/DataElements.md).

## 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).
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](https://iabeurope.eu/tcf-supporting-resources/), 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 SharedPreferences. To enable the SDK to access this data and include it with every event, follow these steps:


  1. Call AppsFlyerLib.getInstance().enableTCFDataCollection(true) to instruct the SDK to collect the TCF data from the device.

  2. Set the the adapter to be manual : AppsflyerAdobeExtension.manual = true.
    This will allow us to delay the Conversion call in order to provide the SDK with the user consent.

  3. Initialize Adobe.

  4. In the Activity class, use the CMP to decide if you need the consent dialog in the current session.

  5. If needed, show the consent dialog, using the CMP, to capture the user consent decision. Otherwise, go to step 6.

  6. Get confirmation from the CMP that the user has made their consent decision, and the data is available in SharedPreferences.

  7. Call AppsFlyerLib.getInstance().start(this)



#### Application class
``` java
override fun onCreate() {
super.onCreate()
AppsFlyerLib.getInstance().enableTCFDataCollection(true)
AppsflyerAdobeExtension.manual = true
MobileCore.setApplication(this);
MobileCore.setLogLevel(LoggingMode.DEBUG);
try {
AppsFlyerAdobeExtension.registerExtension();
Analytics.registerExtension();
Identity.registerExtension();
Lifecycle.registerExtension();
Signal.registerExtension();
UserProfile.registerExtension();
MobileCore.start(new AdobeCallback() {
@Override
public void call(Object o) {
MobileCore.configureWithAppID("Dev-Key");
}
});

AppsFlyerAdobeExtension.registerAppsFlyerExtensionCallbacks(new AppsFlyerExtensionCallbacksListener() {
...
});

} catch (Exception ex) {
Log.d("AdobeException: ",ex.toString());
}
}
```


### 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.


  1. Initialize AppsflyerAdobeExtension using manual mode and also MobileCore. This will allow us to delay the Conversion call in order to provide the SDK with the user consent.

  2. In the Activity class, determine whether the GDPR applies or not 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 an object called AppsFlyerConsent using the forGDPRUser() method with the following parameters:

      - hasConsentForDataUsage - Indicates whether the user has consented to use their data for advertising purposes.

      - hasConsentForAdsPersonalization - Indicates whether the user has consented to use their data for personalized advertising purposes.

    3. Call AppsFlyerLib.getInstance().setConsentData() with the AppsFlyerConsent object.

    4. Call AppsFlyerLib.getInstance().start(this).




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

    1. Create an AppsFlyerConsent object using the forNonGDPRUser() method. This method doesn’t accept any parameters.

    2. Call AppsFlyerLib.getInstance().setConsentData() with the AppsFlyerConsent object.

    3. Call AppsFlyerLib.getInstance().start(this).