Cordova Advance Features

Advanced Features

Debugging

During integration, we recommend that you set the SDK to DEBUG mode, to log warnings or other important messages to the iOS logging system. This can be done by setting the debug level.

Set Debug Level

Debug level can be one of the following:

  • -1: Disables all debugging. You can set the debugLevel to -1 if you want to disable CleverTap logs for the production environment.
  • 0: Default, shows minimal SDK integration related logging.
  • 2: Shows debug output.
  • 3: Shows verbose output.
CleverTap.setDebugLevel(debugLevel);

Push Notifications

Registering FCM Token

CleverTap.setPushToken("<Your FCM Token>");

Native Display

On Display Units Loaded

document.addEventListener('onCleverTapDisplayUnitsLoaded', e => {
            log("onCleverTapDisplayUnitsLoaded")
           }
    )

Get All Display Units

CleverTap.getAllDisplayUnits(val => log("Native Display units are " + JSON.stringify(val)))

Display unit viewed event for ID

CleverTap.recordDisplayUnitViewedEventForID("unitID")

Display unit clicked event for ID

CleverTap.recordDisplayUnitClickedEventForID("unitID")

Product Config

πŸ“˜

Feature Availability

A new and enhanced version of Product Experiences is coming soon. New customers (CleverTap for Enterprise or CleverTap for Startups) who have not enabled the current functionalities can use this feature only when the new version is released. However, the existing users can continue to use it. The methods for the Product Experiences feature have been deprecated and will be removed from the code by September 2024.

Set Product Configuration to Default

document.addEventListener('onCleverTapProductConfigDidInitialize', () => log("onCleverTapProductConfigDidInitialize"))

CleverTap.setDefaultsMap({"test": "val1", "test1": "val2"})

Fetching Product Configs

CleverTap.fetch()
document.addEventListener('onCleverTapProductConfigDidFetch', 
                          () => log("onCleverTapProductConfigDidFetch"))

Activate the most recently fetched product config

CleverTap.activate()
document.addEventListener('onCleverTapProductConfigDidActivate', 
                          () => log("onCleverTapProductConfigDidActivate"))

Fetch And Activate product config

CleverTap.fetchAndActivate();

Fetch Minimum Time Interval

CleverTap.setMinimumFetchIntervalInSeconds(100)

Get Boolean key

CleverTap.getBoolean("test", val => log("Value is " + val))CleverTap.getBoolean("test", val => log("Value is " + val))

Get String Key

CleverTap.getString("test", val => log("Value is " + val))

Get Number key

CleverTap.getDouble("test", val => log("Value is " + val))

Get last fetched timestamp in millis

CleverTap.getLastFetchTimeStampInMillis(val => log("Value is " + val))

Feature Flag

Get Feature Flag

CleverTap.getFeatureFlag("test", true, val => log("Value is " + val))

App Personalization

Enable Personalization

CleverTap.enablePersonalization()

Disable Personalization

CleverTap.disablePersonalization()

Attributions

Push Install Referrer

CleverTap.pushInstallReferrer("source", "medium", "campaign")

GDPR

Set Opt Out

CleverTap.setOptOut(false); ///Will opt in the user to send data to CleverTap
CleverTap.setOptOut(true); ///Will opt out the user to send data to CleverTap

Enable Device Networking Info Reporting

// Will opt out the user to send Device Network data to CleverTap
CleverTap.enableDeviceNetworkInfoReporting(false);
// Will opt in the user to send Device Network data to CleverTap
CleverTap.enableDeviceNetworkInfoReporting(true);

Set Offline

// Will set the user online
CleverTap.setOffline(false);
// Will set the user offline
CleverTap.setOffline(true);

Encryption for PII data

PII data is stored across the SDK and could be sensitive information. From Cordova SDK v2.7.1. onwards, you can enable encryption for PII data such as Email, Identity, Name, and Phone.

Currently, two levels of encryption are supported, i.e., None(0) and Medium(1). The encryption level is None by default.

  • None: All stored data is in plaintext
  • Medium: PII data is encrypted completely

Android

Add encryption level in the AndroidManifest.xml as following:

<meta-data
    android:name="CLEVERTAP_ENCRYPTION_LEVEL"
    android:value="1" />

iOS

The only way to set the encryption level is from the info.plist. Add the CleverTapEncryptionLevel String key to info.plist file, where value 1 means Medium and 0 means None. The encryption level is set to None if any other value is provided.