Unity
Last updated
Was this helpful?
Last updated
Was this helpful?
To integrate devtodev analytics SDK, you can use one of the two methods: by using the Unity Package Manager (recommended) or by manually importing the unitypackage.
If you integrated the devtodev package manually, then you need to delete the Assets/DevToDev and Plugins/DevToDev folders.
Open the Package Manager (Window → Package Manager), click + in the top left corner and select Add package from git URL.
Copy the repository URL to the input box and click Add.
Wait for the Unity Package Manager to download the package.
In the Unity Editor menu, open Assets → Import Package → Custom Package
Select the DTDAnalytics.unitypackage that you have just downloaded
Click Import
Create a script with the following code and attach it to the GameObject
that will survive the entire life cycle of the app.
You can find the AppID in the settings of the respective app in devtodev (Settings → SDK → Integration → Credentials).
config
- an object instance of DTDAnalyticsConfiguration
, which is used for specifying additional properties during the initialization.
DTDAnalyticsConfiguration
Parameter
Type
Description
CurrentLevel
Integer
The player level at the moment of devtodev SDK initialization. It’s optional but we recommend using it for improving data accuracy.
UserId
String
A custom user ID assigned by the developer. In the case of default calculation by device IDs, the identifier can be used for searching users in devtodev. In case the project uses calculation by user IDs, the parameter is mandatory because it becomes the principal calculation ID in devtodev.
TrackingAvailability
DTDTrackingStatus (enum)
The property allows or disallows devtodev tracking of the user. By default, it is set to DTDTrackingStatus.Enable
. SDK stores the previously assigned value. Pass DTDTrackingStatus.Disable
if the user opted out of tracking in line with GDPR.
LogLevel
DTDLogLevel (enum)
The level of logging the SDK activity. The DTDLogLevel.no
value is used by default. For troubleshooting during integration it is recommended to set it to DTDLogLevel.Debug
, and either switch it off DTDLogLevel.No
. Use DTDLogLevel.No
in the release version.
ApplicationVersion
String
The app version during the devtodev SDK initialization. Use the property on the WinStandalone platform only. For all other platforms, data is collected automatically.
Example:
SDK Activity
The SDK can’t control app activity in case you use Windows Standalone therefore this responsibility is shifted to the developer. While initializing the SDK, the activity starts automatically and after that, the activity status will not auto-change. To track app activity, the developer can use the following methods: DTDAnalytics.StartActivity
and DTDAnalytics.StopActivity
. It is recommended to use the DTDAnalytics.StopActivity
method to stop activity when the app goes into the background or gets closed. You can use the DTDAnalytics.StartActivity
method to resume activity when the app gets reopened from the taskbar.
For other platforms, there is no need to manually call the DTDAnalytics.StartActivity
and DTDAnalytics.StopActivity
methods.
If you imported the DTDGoogle package, delete the imported files Assets\Plugins\DevToDev\Android\DTDGoogleAndroid.dll and Assets\DevToDev\Analytics\Editor\GoogleDependencies.xml
In the assets/Plugins/Android/ folder create a settingsTemplate.gradle file with the following content:
Open Window → devtodev and select Create android plugin folder
Copy the “agconnect-services.json“ file to the Assets\Plugins\Android\devtodev.plugin folder
Open Assets → External Dependency Manager → Android ResolverAssets → External Dependency Manager → Android Resolver and click Resolve
To integrate with Xcode, the SDK uses PostProcessBuild
in the DTDPostProcessAnalytics
and DTDPostProcessMessaging
scripts. If you use custom PostProcessBuild
scripts, add them callbackOrder
of less than 98
to avoid conflicts.
When developing and publishing apps targeted at children under 13 years old, you need to ensure special conditions for data processing. Any mobile app aimed at children or intended for users in a region with strict regulations on child online protection, must comply with current laws.
If your app has to comply with the legal requirements (COPPA), use the following recommendations:
Implement the CoppaControlEnable
method. The method disables collection of ad IDs and vendor IDs (IDFA, IDFV).
AppTrackingTransparency.framework
and all the links pointing to it.
AdSupport.framework
and all the links pointing to it.
Set IS_COPPA_ENABLED = true
in DTDPostProcessAnalytics.cs
(Assets/DevToDev/Analytics/Editor
)
Call the CoppaControlEnable
method before SDK initialization. If the method was not called, the SDK will work as before.
If you work with SDK version 3.5.0 and above, and you want to use Google Ad ID, you need to add . When developing and publishing apps for kids , you do not need . Read more about working with in the .
If you work with SDK version 3.5.0 and above, and you want to use Huawei Ad ID, you need to add . When developing and publishing apps for kids , you do not need . Read more about working with in the .
You can pick a specific SDK version by adding # and a version number at the end of the URL, for example: #v3.3.2
Download DTDAnalytics.unitypackage from
If you work with SDK version 3.5.0 and above, and you want to use Google Ad ID, you need to import the DTDGoogle.unitypackage. When developing and publishing apps for kids , you do not need the DTDGoogle.unitypackage. Read more about working with in the .
If you work with SDK version 3.5.0 and above, and you want to use Huawei Ad ID, you need to import the DTDHuawei.unitypackage. When developing and publishing apps for kids , you do not need the DTDHuawei.unitypackage. Read more about working with in the .
To resolve external android dependencies, you need to use .
Add the following strings to proguard.txt ():
Select your project in In the “General information” section find “App information” and download the “agconnect-services.json“ file.
Import the DTDHuawei.unitypackage manually from or use Unity Package Manager with .
To add the following rule:
Your app must request tracking authorization before it can get the advertising identifier. See on how to request it.
At Apple introduced new privacy manifests and xcframework signature. More information about it can be found .
USA:
EU:
To comply with , remove from Xcode project: