Only Unity 5.4 and above is supported.

Please do the following to integrate your application with devtodev:

  1. Add the application to the Space using the wizard for adding an application.

  2. Attention! If your Unity project can be used for compilations for different platforms, you need to add the applications in devtodev for each platform. As a result, the statistics will be gained for each platform separately.

  3. Attention! If you install SDK versions (1.*) 2.0, 2.0.1 or 2.0.2, you have to delete them before integrating the latest version.

    To do that, delete the following files and catalogues:

    For 1.*

    • Assets/DevToDev/ (the folder)

    • Assets/Plugins/Android/ (files android-suport-v4.jar, AndroidManifest.xml, devtodev.jar, devtodev_android_wrapper.jar, google-play-services.jar)

    • Assets/Plugins/iOS/ (files AccrualType.h, CustomEventParams.h, all DevToDev*.h, Gender.h, libdevtodev.a, ReceiptStatus.h, SocialNetwork.h, TimeStatus.h, TutorialState.h)

    • Assets/Plugins/Metro/devtodev.dll

    For 2.0

    • Assets/devtodev (the folder)

    • Assets/Plugins/DevToDevOSX.bundle

    After deleting, unpack devtodev.unitypackage version 2.1 and replace all the files. If you used an interface integration, you have to re-integrate SDK.

  4. Unpack the devtodev.unitypackage into the project

  5. There are 2 types of integration available:

    In the interface.

    • Open the main screen of the app.

    • Open Window/devtodev menu, then you'll see the following window:

  • Switch on "Analytics" by pressing "On" button

  • Add AppKey and SecretKey for all the using platforms (you can select the platform by clicking on it). If you need to debug, switch logging on.

    App ID and Secret key can be found in the application settings (Open "Settings" β†’ "SDK" β†’ "Integration").

  • Script with all needed parameters if SDK initialization and tracking the user session will be automatically created and added to the scene.

Using code. Add the following strings to the GameObject which will be on the scene during the whole cycle of application work:

public class YourBehaviourScript : MonoBehaviour
void Start() 
// <param name="androidAppId"> devtodev App ID for Google Play version of application </param>
// <param name="androidAppSecret"> devtodev Secret key for Google Play version of application </param>
   DevToDev.Analytics.Initialize(string androidAppId, string androidAppSecret);
// <param name="iosAppId"> devtodev App ID for App Store version of application </param>
// <param name="iosAppSecret"> devtodev Secret key for App Store version of application </param>
   DevToDev.Analytics.Initialize(string iosAppId, string iosAppSecret);
// <param name="webglAppId"> devtodev App ID for Web version of application </param>
// <param name="webglAppKey"> devtodev Secret key Web version of application </param>
   DevToDev.Analytics.Initialize(string webglAppId, string webglAppSecret);
// <param name="winAppId"> devtodev App ID for Windows Store version of application </param>
// <param name="winAppSecret"> devtodev Secret key for Windows Store version of application </param>
   DevToDev.Analytics.Initialize(string winAppId, string winAppSecret);

The appId and appSecret values are unique for each app on each platform and can be found in the settings of appropriate app ("Settings" β†’ "SDK" β†’ "Integration").

The specificity of integration on Android platform

Add following lines at the bottom of proguard config

-keep class com.devtodev.** { *; }
-dontwarn com.devtodev.**

The specificity of integration on iOS platform

If you are planning to build an app for iOS, you need to add libz.tbd to the XCode project settings. This library is used by devtodev Unity SDK to compress data sent to devtodev servers. Also, you have to add UserNotifications.framework as an optional library.

Please add AdSupport.framework into the project for your SDK to function correctly with iOS and also add AppTrackingTransparency.framework for iOS 14.

Here’s how you can add them.

Option 1

1. Create Editor folder in the Assets folder.

2. In the Assets folder create DevToDevPostBuild.cs script. The script is below:

using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
namespace DevToDev
   public class DevToDevPostBuild
       const string APP_TARGET_NAME = "Unity-iPhone";
       public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
           if (target != BuildTarget.iOS)
       private static void iOSPostBuild(string projPath)
           string pbxprojPath = projPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
           PBXProject proj = new PBXProject();
           string projectGuid = proj.TargetGuidByName(APP_TARGET_NAME);
           proj.AddFrameworkToProject(projectGuid, "AdSupport.framework", true);
           // IOS 14. Xcode 12 required.
           //proj.AddFrameworkToProject(projectGuid, "AppTrackingTransparency.framework", true);
           File.WriteAllText(pbxprojPath, proj.WriteToString());

3. Uncomment proj.AddFrameworkToProject(projectGuid, "AppTrackingTransparency.framework", true); if necessary.

Option 2.

1. Add AdSupport.framework into the Frameworks section of the generated Unity xcodeproj project.

2. For iOS 14, also add AppTrackingTransparency.framework.

Additional initialization

If the application you integrate SDK in is a part of a cross-platform project, then the user data initialization is required.

Since the analytics of cross-platform projects is based on a unique user (unlike the usual projects where it is based on device identifiers), you have to:

  • Set a unique cross-platform user identifier (it will be used for cross-platform project data collection).

  • Actualize the user data. Mostly it is about game applications where the player has a game level as a characteristic. For such projects, you need to set the current player level.

We recommend you set the user identifier before SDK initialization, otherwise, the user identifier from the previous session will be used since the SDK initialization moment till the UserID property is set.

If your cross-platform application is supposed to be used without cross-platform authorization, don't use the UserID property or use the empty string ("") as the user identifier. SDK will assign the unique identifier to the user. This identifier will be used until the real cross-platform identifier assigns to the user.

/// <summary> Property allows to initialize the user. 
/// It applies when SDK initialization or user relogin.</summary>
/// <param name="activeUserId">unique cross-platform user identifier (max. 64 symbols)</param>
DevToDev.Analytics.UserId = activeUserID;

/// <summary> Method sets the current user level. 
/// Using this method allows to actualize the SDK user data in game cross-platform applications.</summary>
/// <param name="level">number of current game level of the user</param>

/// <summary>  Property allows to set current application version.
/// Attention! This property is necessary for WEB and Windows Standalone apps only.
/// It will be ignored on other platforms.</summary>
/// <param name="version"> current version of your application</param>
DevToDev.Analytics.ApplicationVersion = version;

/// <summary> devtodev App Id and Secret key can be found in the devtodev application
/// settings page ("Settings" β†’ "SDK" β†’ "Integration") </summary>
DevToDev.Analytics.Initialize(string appId, string appSecret);

If your application allows user to re-login (changing the user during the working session of application), then the UserID property and CurrentLevel method should be called just after the authorization. You don't need to call the SDK initialization one more time.

Debug mode

To enable the debug mode and make SDK notifications displayed in the console use this method:

/// <summary> Enable/Disable log</summary>
/// <param name="isEnabled">Enabled/Disabled log</param>
DevToDev.Analytics.SetActiveLog(bool isEnabled);

Collecting data about the amount of sessions and their length

The data about the amount of sessions and their length is collected automatically by default.

In case you want to control the beginning and the end of a session manually, use the methods below:

For the start of the session use the StartSession method:

//Call this when the session starts or is resumed

For the end of the session use the EndSession method:

//Call this when the session is completed

Delivering your application to the Mac App Store

  1. Read an article and make sure you follow all the recommendations.

  2. Delete a meta file from DevToDevOSX.bundle:

    File.Delete (projPath + "/Contents/Plugins/DevToDevOSX.bundle/Contents.meta");
  3. Rename CFBundleIdentifier in Info.plist inside the devtodev plugin, for example:

    string plistPath = appPath + "/Contents/Plugins/DevToDevOSX.bundle/Contents/Info.plist";
    PlistDocument plist = new PlistDocument ();
    plist.ReadFromString (File.ReadAllText (plistPath));
    plist.root.SetString ("CFBundleIdentifier", PlayerSettings.applicationIdentifier + ".devtodev");
    File.WriteAllText (plistPath, plist.WriteToString ());
  4. Sign the DevToDevOSX.bundle with the .entitlements you created earlier. To do this, type the following into the macOS Terminal:

    codesign -f --deep -s 'Mac Developer: Developer Name' --entitlements "yourapp.entitlements" "path/to/your.app/Contents/Plugins/DevToDevOSX.bundle"

Last updated