Cordova/Monaca SDK

1. Supported Cordova Versions

This SDK supports Cordova 5.0 and above.

Android Platform Requirements:
* Cordova-android platform 3.6.4 and above.
* Android SDK 4.4 (android-19) and above.

iOS Platform Requirements:
* Cordova-ios platform 3.7.0 and above.
* OS X El Capitan and above
* XCode 7.0 and above.

Monaca Platform Requirements
※ The Cordova version used by a Monaca project must meet the above requirements.
※ Your Monaca plan must support user installed Cordova plugins.

2. Cordova/Monaca Project Integration

Step1:SDK Integration

  • Cordova
  • Monaca
From the project folder, execute the commands below, or add the shown plugins via your IDE.

cordova plugin add cordova-plugin-smartbeat

* For duplicate user prevention, in place of 'cordova-plugin-smartbeat' use 'cordova-plugin-smartbeat-plus' instead.

From the IDE Menu, select Configure > Cordova Plugin Settings... to open the Cordova Plugins page; from there, click Import Cordova Plugin.

Select Specify URL or Package Name and enter "cordova-plugin-smartbeat" in the Package Name/URL field, then click OK.

* To use Duplicate User Count Prevention, use the 'cordova-plugin-smartbeat-plus' plugin instead of 'cordova-plugin-smartbeat'.

Step2:Setting the API Key

Modify the file www/js/index.js or your application's main JS file to catch the Cordova ondeviceready event, and after substituting the API Key(s) from the SmartBeat console, include the following code in that method:

SmartBeat.startWithApiKey({android: "Android Api Key", ios: "iOS API Key"});

Step3:Duplicate User Count Prevention

By enabling this feature, it is possible to identify a single user even if the user repeatedly uninstalls and re-installs (a.k.a "reset marathon"). That means it is possible to avoid unexpected increases of MAU.

The Audience feature is enabled by using the "Duplicate User Count Prevention" functionality.

If you don't enable this feature, you can skip the following steps.

  • Cordova
  • Monaca
As shown below, remove the cordova-plugin-smartbeat plugin and replace it with the cordova-plugin-smartbeat-plus using the following commands from the project folder of your project, or using your IDE:

cordova plugin rm cordova-plugin-smartbeat
cordova plugin add cordova-plugin-smartbeat-plus
On the Cordova Plugin page, disable the plugin 'cordova-plugin-smartbeat'.

From 'Import Cordova Plugin', import the cordova-plugin-smartbeat-plus plugin.

3. Extra functions

3.1 Log Handled Exceptions

SDK Version 1.2.0 and up

SmartBeat supports handed exceptions logging.

How to use
try {
    throw new Error();
} catch (e) {

3.2 Logging Output

Logs will be gathered internally, and not output to the device log.
*The most recent 64KB or 500 lines of log will be included in crash reports.

How to use

Output logs using the following API calls.

Smartbeat.log("Log message here");

3.3 User ID Setting

If your application provides a user ID for each user, you can include it with crash/exception data. That help you find specific user’s errors by using this user ID on the SmartBeat web console.

How to use

In order to set user ID, call the API below:


3.4 Extra Data Setting

You have another option to add extra custom information into the crash/exception reports. This will help you reproduce and fix errors. (e.g. user’s entering parameters, API return values etc.)

How to use

In order to set a key and a value with crash data, call the API below:


3.5 Leaving Breadcrumbs

You can know what the user did by adding breadcrumbs at any point.

How to use

Call the following API where you'd like to leave a breadcrumb.

SmartBeat.leaveBreadcrumb:("game scene 1");

Only last 128 breadcrumbs are saved and displayed on SmartBeat console.
Typical actions and status changes are automatically recorded as breadcrumbs. Please see here (Android / iOS) for details of what is recorded.

3.6 Audience Function

By using the Advertising ID for Android or IDFA for iOS, it's possible to understand the gender and age distribution of your users.

How to use

The Audience feature is enabled by using the "Duplicate User Prevention" functionality. Please see details regarding the settings for Duplicate User prevention here.