Apxor
IntegrationProduct Guides
  • Introduction to Apxor
  • Getting Started with Apxor
    • Adding a New App
    • Firebase Credentials (optional)
    • SDK
      • Android (x)
      • iOS SDK
      • iOS SDK (Swift UI)
      • iOS SDK (Manual)
      • Web npm based
        • Tracking Events and Pages for Web
      • Web URL based
        • Tracking Events and Pages for Web
      • React Native
      • Cordova
      • Flutter
      • Jetpack Compose
    • API Guides
      • iOS
      • Web
      • React Native
      • Cordova
      • Flutter
    • Release Notes
    • Performance
    • Troubleshooting
  • Product Guides
    • Integration Checklist
    • Create a Campaign
      • Mobile
        • Target
        • Trigger
        • Schedule and Limit
        • Review and Test
        • Set Priority and Publish
        • A/B Testing
        • Campaign Listings Page
        • Campaign Analytics
        • Campaign Designs
          • Tooltips
          • In-App Messages
          • Coachmarks
          • Badges
      • Web
        • Target
        • Trigger
        • Schedule and Limit
        • Review and Test
        • Set Priority and Publish
        • A/B Testing
        • Campaign Listings Page
        • Campaign Analytics
        • Web Templates
    • Create a Survey
      • Legacy
        • Target
        • Trigger
        • Schedule and Limit
        • Review and Test
        • Publish
        • Survey Listings Page
        • Survey Analytics
        • Survey Designs
          • Request for Survey
          • Single Response
          • Multi Response
          • Rating
          • Short Answer
          • Success Message
      • Latest
        • Survey Stop Conditions
        • Target
        • Trigger
        • Schedule and Limit
        • Review and Test
        • Publish
        • Survey Listings Page
    • Custom Reports
    • Analytics
      • Custom Dashboards
      • Uninstalls
      • Retention
      • Funnels
      • Paths
      • Event Analysis
    • BI Dashboard
      • Frequency
      • Aggregates
      • Trends
      • Pie Chart/Advanced Pie Chart
      • Table
    • Insights
      • Activation Analysis
      • Correlation Analysis
    • Adding a Test Device
    • Preview vs. Test vs. Publish
    • Dynamic Script
  • Partner Integrations
    • Mixpanel
    • MoEngage
    • Amplitude
    • CleverTap
  • Glossary of Terms
  • Video Gallery
  • Beta Features
    • Create Embedded Cards Campaign
    • Create Stories Campaign
Powered by GitBook
On this page
  • Things to keep handy before starting your integration with Apxor
  • Android Integration
  • Step 1: Getting started
  • Step 2: Add Proguard Rules
  • Step 3: Initialize Apxor Android SDK
  • Step 4: Enable uninstall tracking for your users [Optional]
  • Step 5: To view tooltips, Coachmark and Badges
  • Step 6: Ensuring ApxorSDK is initialised successfully
  • Step 7: Log data to set up triggers and measure goals
  • iOS integration
  • Initialize Apxor iOS SDK
  • To show tooltips
  • Ensuring ApxoriOSSDK is initialised successfully
  • Additional features API Guide
  1. Getting Started with Apxor
  2. SDK

Cordova

PreviousReact NativeNextFlutter

Last updated 5 months ago

Things to keep handy before starting your integration with Apxor

Please have the following handy before beginning the integration:

  • Application identifier generated on the Apxor dashboard for your app ()

  • App Bundle Id : Every app has a unique application ID that looks like com.example.myapp. This id uniquely identifies the app on the device and also on the app store.

  • The list of events to setup triggers and track goals, user properties that allows to personalize messages and to target better. ()

Android Integration

Step 1: Getting started

Run the following command in your terminal from the project folder. This command will fetch the apxor plugins for you.

cordova plugin add cordova-plugin-apxor-sdk

Step 2: Add Proguard Rules

Note

If you use proguard to obfuscate the classes, you have to add the following to ignore obfuscation for Apxor SDK classes

Configure the below rules in your proguard-rules.pro file

Path: <project>/<app-module>/gradle.properties:

-keep class com.apxor.** { *; }
-dontwarn com.apxor.**

Note:

If you use androidx libraries, add the following property in gradle.properties file

android.enableJetifier = true

Step 3: Initialize Apxor Android SDK

  • To Auto initialize SDK (Recommended), add following meta-data tag inside your application tag in your AndroidManifest.xml file

    <application>
        <!-- You must replace your app in android:value attribute -->
        <meta-data android:name="APXOR_APP_ID" android:value="APP_ID" />
    </application>
  • To manually initialize SDK, call ApxorSDK.initialize method in your Application class

    //...
    import com.apxor.androidsdk.core.ApxorSDK;
    
    public class MyApplication extends Application {
        @Override
        public void onCreate() {
            // ...
            ApxorSDK.initialize(<YOUR_APP_ID>, this.getApplicationContext());
        }
    }

Step 4: Enable uninstall tracking for your users [Optional]

Note

  • If you would like to track uninstalls, you must include apxor-android-sdk-push dependency in app/build.gradle file and corresponding JSON object in assets/plugins.json file

  • Apxor sends silent push notifications to track uninstalls. Please make sure you handle push notifications which will be sent with your SENDER_ID and ignore all notifications other than your SENDER_ID

Apxor uses your firebase server key to send silent push notifications to track uninstalls in order to measure outcomes of your campaign. To enable this please do the following :

Path : app/build.gradle

firebase-messaging version >= 22.0.0
  • Add the following dependency in your app/build.gradle

    dependencies {
      // Add this to track uninstalls and send push notifications from Apxor dashboard
      implementation('com.apxor.androidx:apxor-android-sdk-push-v2:1.2.7@aar') {
        exclude group: 'com.google.firebase'
      }
    }
  • Add the following in plugins.json file

    {
      "plugins": [
        {
          "name": "push",
          "class": "com.apxor.androidsdk.plugins.push.v2.PushPlugin"
        }
      ]
    }
firebase-messaging version < 22.0.0
  • Add the following dependency in your app/build.gradle

    dependencies {
      // Add this to track uninstalls and send push notifications from Apxor dashboard
      implementation('com.apxor.androidx:apxor-android-sdk-push:1.2.7@aar') {
        exclude group: 'com.google.firebase'
      }
    }
  • If you are not using FirebaseMessagingService, you can skip this step. Otherwise, add the following

    public class MyFirebaseMessagingService extends FirebaseMessagingService {
        @Override
        public void onMessageReceived(RemoteMessage remoteMessage) {
            // Creating Notification Channel
            ApxorPushAPI.createNotificationChannel(this.getApplicationContext(), "Apxor", "Apxor", "Apxor");
            if (remoteMessage.getFrom().equals(YOUR_FCM_SENDER_ID)) {
                // Push Notification receiver with your Sender Id
            } else {
                // Check if Push Notification received from Apxor
                if (ApxorPushAPI.isApxorNotification(remoteMessage)) {
                    ApxorPushAPI.handleNotification(remoteMessage, getApplicationContext());
                } else {
                    // Silent or Data push notification which you can send through Apxor dashboard
                }
            }
        }
    }
  • Add the following in plugins.json file

    {
      "plugins": [
        {
          "name": "push",
          "class": "com.apxor.androidsdk.plugins.push.PushPlugin"
        }
      ]
    }

Step 5: To view tooltips, Coachmark and Badges

Note

To anchor a tooltip or coachmark or badge to any UI element, this step is mandatory.

If you will only use In-app messages, this step can be skipped.

In your MainActivity onCreate method you must set the tag for the WebView as follows to view the tooltips.

public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        // Your logic goes here

        appView.getView().setTag("MyWebView");
    }
}

Step 6: Ensuring ApxorSDK is initialised successfully

We have to verify for two things as follows :

SDK Initialisation

On running your android project lookout for the following log in logcat :

ApxorSDK(v2**) successfully initialized for: APP_ID

Plugin Initialisation

By default, only error logs are enabled. To see debug logs for plugin initialisation and to confirm tracking event triggers, user properties. Please run the below command in terminal

adb shell setprop log.tag.Apxor VERBOSE

Note

Apxor uploads data only when the app is minimized to the background. If you are running from Android Studio (emulators or devices), do not stop the app, just press on the "home" button in order for data to be uploaded.

Step 7: Log data to set up triggers and measure goals

Now as we are done with basic integration, we can go ahead to setup event triggers, capture data for targeting and to personalize messaging.

iOS integration

Initialize Apxor iOS SDK

  • To Auto initialize SDK, add the following inside your application plist file.

  • Open your application's Info.plist as source code.

  • Copy paste the below piece of code, to create an entry for ApxorSDK.

  <key>Apxor</key>
  <dict>
      <key>Core</key>
      <string>{YOUR_APP_ID}</string>
      <key>APXSurveyPlugin</key>
      <true/>
      <key>APXRTAPlugin</key>
      <true/>
      <key>APXWYSIWYGPlugin</key>
      <true/>
  </dict>

To show tooltips

  • In your MainViewController (the ViewController extending the CDVViewController) init method you must set the tag for the WebView as follows to view the tooltips.

  // ...
  if (self.webView != null) {
    [self.webView setTag:123];
    NSLog(@"My webview is: %@", self.webView);
  } else {
    NSLog(@"Error in setting TAG to webview");
  }
  // ...

Note

Ensure your webview isn't null and the TAG is set correctly.

Ensuring ApxoriOSSDK is initialised successfully

  • Lookout for the following log in console output,

     ApxoriOSSDK (2XX) : initialized!

Note

Apxor uploads data only when the app is minimized to the background. If you are running from XCode (emulators or devices), do not stop the app, just press on the "home" button in order for data to be uploaded.

Additional features API Guide

Click here to and

on how to get your firebase sender ID and also FCM server key to share it with apxor to configure uninstall tracking.

to log user properties, events and event properties.

to log user properties, events and event properties.

Read more on how to fetch the application identifier from Apxor dashboard
(Know more about bundle ids here)
Read more on how you can setup here
Read here
Please follow the guide here
Click here for guides
Add New App
how to get the app id