If you have previously used the Unity SDK version 2+, you need to delete the following files and folders in the "Assets" folder of your project:
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 https://github.com/devtodev-analytics/package_Analytics.git to the input box and click Add.
Wait for the Unity Package Manager to download the package.
If you work with SDK version 3.5.0 and above, and you want to use Google Ad ID, you need to add devtodev-analytics/package_Google. When developing and publishing apps for kids (COPPA), you do not need devtodev-analytics/package_Google. Read more about working with COPPA in the COPPA section.
If you work with SDK version 3.5.0 and above, and you want to use Huawei Ad ID, you need to add https://github.com/devtodev-analytics/package_Huawei.git. When developing and publishing apps for kids (COPPA), you do not need https://github.com/devtodev-analytics/package_Huawei.git. Read more about working with COPPA in the COPPA section.
You can pick a specific SDK version by adding # and a version number at the end of the URL, for example: https://github.com/devtodev-analytics/package_Analytics.git#v3.3.2
Download DTDAnalytics.unitypackage from http://github.com/devtodev-analytics/Unity-sdk-3.0/releases/latest
In the Unity Editor menu, open Assets → Import Package → Custom Package
Select the DTDAnalytics.unitypackage that you have just downloaded
Click Import
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 (COPPA), you do not need the DTDGoogle.unitypackage. Read more about working with COPPA in the COPPA section.
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 (COPPA), you do not need the DTDHuawei.unitypackage. Read more about working with COPPA in the COPPA section.
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
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.
In the version 2019.2, the Executable Only option was added to the Build Type. This option is incompatible with the SDK because the SDK needs access to the project file in order to register the DevToDev.Background
service.
To resolve external android dependencies, you need to use External Dependency Manager for Unity.
Add the following strings to proguard.txt (read more about Unity proguard here):
Select your project in https://developer.huawei.com/consumer/en/service/josp/agc/index.html#/myProject In the “General information” section find “App information” and download the “agconnect-services.json“ file.
If you imported the DTDGoogle package, delete the imported files Assets\Plugins\DevToDev\Android\DTDGoogleAndroid.dll and Assets\DevToDev\Analytics\Editor\GoogleDependencies.xml
Import the DTDHuawei.unitypackage manually from GitHub or use Unity Package Manager with DTDHuawei package.
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 proguard add the following rule:
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.
Your app must request tracking authorization before it can get the advertising identifier. See the detailed instruction on how to request it.
If you want to disable tracking of advertising identifiers, you need to open the DTDPostProcesssAnalytics.cs file and comment out the line 39: project.AddFrameworkToProject(targetGuid, "AppTrackingTransparency.framework", true);
At WWDC23 Apple introduced new privacy manifests and xcframework signature. More information about it can be found here.
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.
Please study the following requirements:
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).
To comply with Apple’s guidelines, remove from Xcode project:
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
)
Implement the CoppaControlEnable
method. The method disables collection of ad IDs and vendor IDs.
If you are using DTDGoogle or DTDHuawei from Unity Package Manager, disable it.
If you are using DTDGoogle.unitypackage, remove the following files:
If you are using DTDHuawei.unitypackage, remove the following files:
Call the CoppaControlEnable
method before SDK initialization. If the method was not called, the SDK will work as before.
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.