Get started

This guide walks you through the process of adding the Contentsquare SDKs to your Cordova application. The Contentsquare Plugin for Cordova is a plugin between the Contentsquare SDKs for iOS and Android, and your Cordova JavaScript code. It allows for the use of our solution both in native and JavaScript parts of your app. The Contentsquare functionality is provided through a simple NPM package including only the plugin and dependencies to specific versions of the SDKs. Check the compatibility section for more information about these dependencies, and the minimum Cordova version compatible for each version of the Plugin.

Open up a terminal window and navigate to the folder where your application is stored. First, find the latest version of the plugin compatible with your version of Cordova using our compatibility table. Then, install the plugin as follows, specifying the exact version you want to install if needed:

Terminal window
cordova plugin add @contentsquare/cordova-plugin

How to use the plugin in your JavaScript code

Section titled How to use the plugin in your JavaScript code

The plugin defines an object ContentsquarePlugin. Although the object is in the global scope, features provided by this plugin are not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// ContentsquarePlugin is now available
}

You do not need to do anything to start the SDK. Now that the SDK is a dependency of your app, it will autostart itself when your application starts.

Look at the native SDK docs for validation on each platform.

📚 Validate Android SDK integration
📚 Validate iOS SDK integration