adjust-icon

Cordova SDK integration guide

The Adjust Cordova SDK enables you to measure attribution, events, and much more in your Cordova app. Follow the steps in this guide to set up your app to work with the Adjust SDK. You can also check out the example apps on GitHub.

1. Add the SDK to your project

The Adjust Cordova SDK is available as a plugin on npm. To add it to your project,

Cordova plugin

To add the Adjust Cordova SDK to your Cordova plugin, run the following command:

Terminal window
> cordova plugin add com.adjust.sdk
Fetching plugin "com.adjust.sdk" via npm
Installing "com.adjust.sdk" for android
Installing "com.adjust.sdk" for ios

Ionic

If you use Ionic to build your app, add the SDK and its TypeScript typings from the awesome-cordova-plugins repository by running the following commands:

Terminal window
> npm install @awesome-cordova-plugins/adjust --save
> ionic cordova plugin add com.adjust.sdk

2. Set up Android devices

Add permissions

The Adjust SDK includes the com.google.android.gms.AD_ID and android.permission.INTERNET permissions by default. You can remove the AD_ID permission by adding a remove directive if need to make your app COPPA-compliant or if you don't target the Google Play Store.

<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />
</config-file>

Set up install referrer

The Adjust SDK enables support for the Google Play Referrer API by default. The Meta Install Referrer is available as a plugin for Android. See the Cordova Meta Install Referrer plugin for integration details.

3. Add iOS frameworks

The Adjust SDK automatically links the frameworks listed below on iOS devices.

FrameworkDescriptionNotes
AdSupport.frameworkEnables access to the device's IDFA. Also enables access to LAT information on devices running iOS 14 or earlierDon't add this framework if your app targets the "Kids" category
AdServices.frameworkHandles Apple Search Ads attribution
StoreKit.frameworkEnables access to the SKAdNetwork frameworkRequired to allow the Adjust SDK to handle communication with SKAdNetwork on devices running iOS 14 or later
AppTrackingTransparency.frameworkRequired to allow the Adjust SDK to wrap user tracking consent dialog and access consent responses on devices running iOS 14 or laterDon't add this framework if your app targets the "Kids" category

4. Set up SDK Signature

If you want to use the SDK signature library to secure communications between the Adjust SDK and Adjust's servers, follow the instructions in the SDK signature guide on the Adjust Help Center.

5. Initialize the Adjust SDK

Make sure you initialize the Adjust SDK as soon as possible in your Cordova app. To do this:

  1. Instantiate an AdjustConfig object with the following information:
    • appToken: Your Adjust app token.
    • environment: The environment your app is running in. Set this to AdjustConfig.EnvironmentSandbox to test your app locally.
  2. Pass your AdjustConfig instance to the Adjust.initSdk method to initialize the SDK.
var adjustConfig = new AdjustConfig(
"{YourAppToken}",
AdjustConfig.EnvironmentSandbox,
);
Adjust.initSdk(adjustConfig);

6. Build your app

Well done! You should now be able to build and run your Cordova app. Enable logging to check for any issues. Check your logs to see the Install tracked message.

You are ready to start attributing your users with the Adjust SDK.

7. Test your integration

The Adjust SDK provides tools for testing and troubleshooting issues with your integration. To test your setup:

  • Set your environment to AdjustConfig.EnvironmentSandbox.
  • Add a sandbox filter to your Adjust dashboard results.
  • Set your log level to AdjustConfig.LogLevelVerbose.

If you encounter any issues, email support@adjust.com with all details and logs.

Test Google Play Services integration

To test that the Adjust SDK can receive a device's Google Advertising ID, set the log level to verbose and the environment to Sandbox. Start your app and measure a session or an event. The SDK logs the gps_adid (Google Play Services Advertiser ID) parameter if it has read the advertising ID.

If you're experiencing issues retrieving the Google Advertising ID, open an issue in the SDK GitHub repository or contact support@adjust.com