The Adjust Unity SDK enables you to record attribution, events, and more in your Unity app. Follow the steps in this guide to set up your app to work with the Adjust SDK.
1. Get the Adjust SDK
To use the Adjust SDK in your Unity app, you need to add it to your project. You can download the latest version from the GitHub releases page.
To import the Adjust SDK to your Unity project:
- Open the Unity Editor.
- Select Assets --> Import Package --> Custom Package.
- Select the downloaded SDK package.
2. Integrate the SDK
The Adjust SDK contains a Unity prefab that includes a template game object and an Adjust script. You can use this script to configure the SDK. To open the prefab in the Unity editor:
- Add the prefab from
Assets/Adjust/Adjust.prefab
to your first scene. - Open the prefab Inspector Menu.
- The prefab menu contains editable fields that control the behavior of the Adjust SDK.
To set up the Adjust SDK, enter the following information:
- Your App Token. See App settings for instructions on how to find your token.
- Your Environment:
- Choose Sandbox if you are testing your app and want to send test data. You need to enable sandbox mode in the dashboard to see test data.
- Choose Production when you have finished testing and are ready to release your app.
- Your Log Level. This controls what logs you receive. See Set log level for more information.
The Adjust SDK starts when the app's Awake event triggers by default. To override this behavior, check the START SDK MANUALLY option. This enables you to initialize the Adjust SDK by calling Adjust.start()
with your config instance as an argument.
3. Set up Android devices
Add Google Play Services
Apps that target the Google Play Store must use the gps_adid (Google Advertising ID) to identify devices. You need to add the play-services-ads-identifier
AAR to your project to access the gps_adid
.
Collect App Set Identifier
The App Set Identifier is a unique identifier that enables you to measure information from any of your apps that a user has installed on their device. All apps by the same developer share the same App Set ID, meaning you can gather meaningful insights from users across all your apps.
Set up Proguard
If you are using Proguard, add the following rules to your custom Proguard file.
Set up install referrer
The install referrer is a unique identifier which you can use to attribute an app install to a source. The Adjust SDK requires this information to perform attribution. There are two methods you can use to gather this information depending on which stores you target:
- Use the Google Play Referrer API.
- Use the Huawei Referrer API.
Google Play Referrer API
There are 2 ways to add support for the Google Play Referrer API:
Huawei Referrer API
As of v4.21.1, the Adjust SDK supports install measurement on Huawei devices using Huawei App Gallery v10.4 and later. You don't need to make any changes to start using the Huawei Referrer API.
Meta referrer integration
The Adjust SDK supports the Meta Install Referrer in v4.36.0 and above. To enable this feature:
Find your Meta app ID in your App Dashboard. See Meta's App Dashboard documentation for more information.
Pass your App ID as a
string
argument to theAdjustConfig.setFbAppId
method.
4. Add the iOS privacy manifest
iOS 17 introduced Privacy manifests, a mechanism that informs the App Store of your app's privacy requirements. The Adjust Unity SDK doesn't bundle this Privacy manifest file, so you need to ensure the contents of the Adjust iOS SDK Privacy manifest file are present in your app's Privacy manifest if your app targets devices running iOS 17 or later.
To add the Adjust Privacy manifest:
- Ensure you're using Adjust Unity SDK v4.38.0 or greater.
- Create a Privacy manifest if you haven't already.
- Download the
PrivacyInfo.xcprivacy
file from GitHub or copy its contents. - Make sure the content of Adjust's
PrivacyInfo.xcprivacy
file is present in your own Privacy manifest file.
When you submit your app to the App Store, Adjust's privacy declarations are included with your app.
5. Build your app
To complete the app build process, the Adjust Unity package performs custom post-build actions to ensure the Adjust SDK works in your app.
This process is performed by the OnPostprocessBuild
method in AdjustEditor.cs
. Output logs show up in the Unity IDE console output window.
iOS
The iOS post-build process makes the following changes to your generated Xcode project:
- Adds the other linker flag
-ObjC
: required to recognize Adjust Objective-C categories at build time. - Enables Objective-C exceptions.
Frameworks
You can enable the following frameworks to access iOS features:
AdServices.framework
: Required for Apple Search Ads measurementAdSupport.framework
: Required to read the device IDFAAppTrackingTransparency.framework
: Required to ask for user's consent to be measured and obtain consent statusStoreKit.framework
: Required to communicate with the SKAdNetwork framework.iAd.framework
Deprecated: UseAdServices.framework
App Tracking Transparency consent dialog
If you are using the ATT (App Tracking Transparency) wrapper, enter a User Tracking Description message. This displays when you present the ATT consent dialog to your user.
Deep linking
To enable deep linking, add the following information:
- iOS Universal Links Domain: The associated domain used for universal links.
- iOS URL Identifier: Your app's bundle ID.
- iOS URL Schemes: The URL scheme associated with your app.
Android
The Android post-build process checks for an AndroidManifest.xml
file in Assets/Plugins/Android/
. If this file isn't present, it creates a copy from AdjustAndroidManifest.xml
.
Permissions
You can enable the following permissions to access Android features:
android.permission.INTERNET
: Required to connect to the internet.android.permission.ACCESS_NETWORK_STATE
: Required to read the type of network the device is connected to.com.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE
Deprecated: Required to fetch install referrer information via Google Play Store intent.com.google.android.gms.permission.AD_ID
: Required to read the device advertising ID on Android 12 (API level 31) and above. See Google'sAdvertisingIdClient.info
documentation for more information.
Deep linking
To enable deep linking, add the following information:
Android URI Schemes: The destination of your deep link.
6. Add the Adjust SDK signature
You can use the Adjust SDK signature to sign all communications sent by the Adjust SDK. This enables Adjust’s servers to detect and reject any install activity that's not legitimate.
To get started with the Adjust SDK signature, contact your Technical Account Manager or support@adjust.com
7. Test your integration
The Adjust SDK provides tools for testing and troubleshooting issues with your integration. To test your setup:
- Set your environment to
AdjustEnvironment.sandbox
. - Add a sandbox filter to your Adjust dashboard results.
- Set your log level to
AdjustLogLevel.Verbose
.
Test Google Play Services integration
To test that the Adjust SDK can receive a device's Google Advertising ID, set the log level to AdjustLogLevel.Verbose
and the environment to AdjustEnvironment.sandbox
. Start your app and measure a session
or an event. The SDK logs the gps_adid (Google Play Services Advertiser ID) parameter if it has read the advertising ID.
If you are having issues retrieving the Google Advertising ID, open an issue in the GitHub repository or contact support@adjust.com