devtodev SDK for Cordova analytics part integration

Attention! The support of the SDK for this platform has been suspended!


To integrate your application with devtodev system please perform the following actions:

Integration

To integrate SDK you have to add downloaded plugin into your project

cd ~/path_to_your_project
cordova plugin add ~/path_to_devtodev_plugin

Initialization

/**
* @param {string} appId - devtodev App ID, unique App ID can be found in the application
* settings (“My apps” → App Name → “Settings” → “Integration”)
* @param {string} secretKey - devtodev Secret key, unique key can be found in the application
* settings (“My apps” → App Name → “Settings” → “Integration”)
*/

plugins.devtodev.init(appId, secretKey);

Additional initialization

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

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

  • Set the 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 kind of projects you need to set the current player level.

Attention! If your application allows user to relogin (change users during the working session of the app), then the setUserID and setCurrentLevel methods should be called just after the authorization. You don't need to call the SDK initialization one more time.

​We recommend you to 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 setUserID method call.

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

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

plugins.devtodev.setUserId(userId);

/**
* Method sets the current user level. Using this method allows to actualize the SDK user data in game cross-platform applications.
* @param {number} userLevel - Сurrent game level of the player.
*/
plugins.devtodev.setCurrentLevel(userLevel);

/**
* @param {string} appId - devtodev App ID, unique App ID can be found in the application
* settings (“My apps” → App Name → “Settings” → “Integration”)
* @param {string} secretKey - devtodev Secret key, unique key can be found in the application
* settings (“My apps” → App Name → “Settings” → “Integration”)
*/

plugins.devtodev.init(appId, secretKey);

Attention! If your application allows user to relogin (changing the user during the working session of application), then the setUserId  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:

/**
* Activates console log
* @param {boolean} isActiveLog
*/

plugins.devtodev.setActiveLog(isActiveLog);

 

Push notifications
Basic Methods