Please do the following to integrate your web application with devtodev:

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

  2. To integrate SDK, add the following line to the tag of your page:

<script type="text/javascript" src="https://cdn.devtodev.com/sdk/web/v1/devtodevsdk.js">


In order for SDK for WEB to start working, it is necessary to perform initialization right after the page is loaded and you have a basic user identifier at your disposal.

* @param {string} apiKey - devtodev API key, unique API key can be found in the application
* settings ("Settings" → "SDK" → "Integration")
* @param {string} userId - Unique user identifier.
* For example, user’s ID in a social network, or a unique account name used
* for user identification on your server.
* @param {string} previousUserId - Previous unique user identifier. Optional.
* It is used in case of change of the user identifier.

devtodev.init(apiKey, userId, previousUserId);

In case User ID is changed after SDK was initiated, the method should be called repeatedly with indication of a new User ID. For example, when user signs into another account in a launched messenger application.

If a user has no unique identifier, e.g. if it is possible to use your application / site without authorization), but you need to get stats for such users, don't set userId during the initialization or set an empty string ("") or null as value of userId. SDK will assign the unique identifier to the user. This identifier will be used until the real identifier assigns to the user.

Unique API key can be found in the application settings: "Settings" → "SDK" → "Integration".

Cross-platform application Initialization

In cross-platform applications, the additional user identifier can be used. It is a user cross-platform ID which is unique for all of the platforms. And if a cross-platform ID differs from the ID that is main for the platform, you need to set the cross-platform ID. The cross-platform ID combines the user data for a cross-platform project.

We recommend you apply this method before the SDK initialization, otherwise, the user identifier from the previous session will be used since the SDK initialization moment till the setCrossplatformUserId method call.

If it is difficult to do, set a cross-platform ID as soon as it is available in the application after SDK initialization.

* Initializes the user with the specified cross-platform identifier
* @param {string} сrossplatformUserId - unique cross-platform user ID used
* for user identification on your server.


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

Additional initialization

For the most precise data collection, we strongly recommend specifying some information about the user right after SDK is initiated.

User data initialization

In the first place, this additional initialization is required for gaming applications where the player has a game level as a characteristic.

* Initializes the current user level. Required if level feature used in the app.
* @param {number} currentUserLevel- Сurrent game level of the player.


Application data initialization

It is not obligatory, but if you want to have the ability to build reports with regard to the version of your application, use this method before initialization.

* @param {Object} appData - App data object.
* @param {string} appData.appVersion - Current app version. Required.
* @param {number} appData.codeVersion - Current code version. Optional.


Debug mode

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

* Activates console log
* @param {boolean} status


Last updated