title | category | parentDoc | order | hidden |
---|---|---|---|---|
Integration |
5f9705393c689a065c409b23 |
6370c9e2441a4504d6bca3bd |
2 |
false |
You can initialize the plugin by using the AppsFlyerObject prefab or manually.
- Using the AppsFlyerObject.prefab
- Manual integration
- Collect IDFA with ATTrackingManager
- Sending SKAN postback to Appsflyer
- MacOS initialization
- Request Listeners (Optional)
- Go to Assets > AppsFlyer and drag AppsFlyerObject.prefab to your scene.
2. Update the following fields:
Setting | Description |
---|---|
Dev Key | AppsFlyer's Dev Key, which is accessible from the AppsFlyer dashboard. |
App ID | Your iTunes Application ID. (If your app is not for iOS the leave field empty) |
Get Conversion Data | Set this to true if your app is using AppsFlyer for deep linking. |
Is Debug | Set this to true to view the debug logs. (for development only!) |
- Update the code in Assets > AppsFlyer > AppsFlyerObjectScript.cs with other available API.
Create a game object and add the following init code:
using AppsFlyerSDK;
public class AppsFlyerObjectScript : MonoBehaviour
{
void Start()
{
AppsFlyer.initSDK("devkey", "appID");
AppsFlyer.startSDK();
}
}
Note:
- Make sure not to call destroy on the game object.
- Use
DontDestroyOnLoad
to keep the object when loading a new scene.
-
Add the
AppTrackingTransparency
framework to your xcode project. -
In the
Info.plist
:- Add an entry to the list: Press + next to
Information Property List
. - Scroll down and select
Privacy - Tracking Usage Description
. - Add as the value the wording you want to present to the user when asking for permission to collect the IDFA.
- Add an entry to the list: Press + next to
-
Call the
waitForATTUserAuthorizationWithTimeoutInterval
api beforestartSDK()
#if UNITY_IOS && !UNITY_EDITOR AppsFlyer.waitForATTUserAuthorizationWithTimeoutInterval(60); #endif
-
Reques the tracking authorization where you wish to display the prompt:
You can use the following package or any other package that allows you to request the tracking authorization.using Unity.Advertisement.IosSupport; /* ... */ if (ATTrackingStatusBinding.GetAuthorizationTrackingStatus() == ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED) { ATTrackingStatusBinding.RequestAuthorizationTracking(); } /* ... */
To register the AppsFlyer endpoint, you need to add the NSAdvertisingAttributionReportEndpoint
key to your info.plist and set the value to https://appsflyer-skadnetwork.com/
.
More info on how to update the info.plist can be found here.
- Use the prefab
AppsFlyerObject
- Add your MacOS app id
- Build for the platform
PC, Mac & Linux Standelone
and chooseMacOS
as the target platform.
- Attach the 'AppsFlyer.cs' script to the game object with the AppsFlyer init code. (AppsFlyerObject, ect)
- Add the following code before startSDK()
Sessions response example:
void Start()
{
AppsFlyer.OnRequestResponse += AppsFlyerOnRequestResponse;
AppsFlyer.initSDK(devKey, appID, this);
AppsFlyer.startSDK();
}
void AppsFlyerOnRequestResponse(object sender, EventArgs e)
{
var args = e as AppsFlyerRequestEventArgs;
AppsFlyer.AFLog("AppsFlyerOnRequestResponse", " status code " + args.statusCode);
}
In-App response example:
void Start()
{
AppsFlyer.OnInAppResponse += (sender, args) =>
{
var af_args = args as AppsFlyerRequestEventArgs;
AppsFlyer.AFLog("AppsFlyerOnRequestResponse", " status code " + af_args.statusCode);
};
AppsFlyer.initSDK(devKey, appID, this);
AppsFlyer.startSDK();
}
statusCode | errorDescription |
---|---|
200 | null |
10 | "Event timeout. Check 'minTimeBetweenSessions' param" |
11 | "Skipping event because 'isStopTracking' enabled" |
40 | Network error: Error description comes from Android |
41 | "No dev key" |
50 | "Status code failure" + actual response code from the server |