Cordova and Ionic SDK Installation

Important

  • Currently, Cordova/Ionic packages only support Android.

Cordova

Note

Clarity requires cordova-android version +11.0.0.

Step 1

Run the following command to add the package.

cordova plugin add cordova-clarity

Step 2

Add the code to start Clarity.

var success = function(message) {}
var failure = function(message) {}

ClarityPlugin.initialize("<ProjectId>", success, failure);

Refer to the available APIs and how to use them here.

Step 3

After integrating Clarity with your application, if you'd like to test it on a device or an emulator, please make sure of the following:

  1. Your device/emulator is connected to the internet.
  2. Your device/emulator Android version is within the supported range 29-34 inclusive.
  3. On your first run, you might need to set the log level to Verbose to get the Clarity logs. These logs might be helpful in identifying the initialization errors, if any.

Allow approximately 2 hours for the data to appear in your Clarity project on the Clarity website.

Ionic (Capacitor)

Step 1

Run these commands to add the package:

npm install cordova-clarity cordova-plugin-device

Step 2

Add this code to start Clarity.

var success = function(message: string) {}
var failure = function(message: string) {}

declare let ClarityPlugin: any;
ClarityPlugin.initialize("<ProjectId>", success, failure, {isIonic: true});

Refer to the available APIs and how to use them here.

Step 3

Run this command:

ionic cap sync

Step 4

After integrating Clarity with your application, if you'd like to test it on a device or an emulator, please make sure of the following:

  1. Your device/emulator is connected to the internet.
  2. Your device/emulator Android version is within the supported range 29-34 inclusive.
  3. On your first run, you might need to set the log level to Verbose to get the Clarity logs. These logs might be helpful in identifying the initialization errors, if any.

Allow approximately 2 hours for the data to appear in your Clarity project on the Clarity website.

Ionic (Cordova)

Note

Clarity requires cordova-android version +11.0.0.

Step 1

Run the following command to add the package.

ionic cordova plugin add cordova-clarity

Step 2

Add the code to start Clarity.

var success = function(message: string) {}
var failure = function(message: string) {}

declare let ClarityPlugin: any;
ClarityPlugin.initialize("<ProjectId>", success, failure, {isIonic: true});

Refer to the available APIs and how to use them here.

Step 3

After integrating Clarity with your application, if you'd like to test it on a device or an emulator, please make sure of the following:

  1. Your device/emulator is connected to the internet.
  2. Your device/emulator Android version is within the supported range 29-34 inclusive.
  3. On your first run, you might need to set the log level to Verbose to get the Clarity logs. These logs might be helpful in identifying the initialization errors, if any.

Allow approximately 2 hours for the data to appear in your Clarity project on the Clarity website.

FAQ

For more answers, refer to FAQ.

Visit Clarity

:::column-end:::