Cordova Advance Features

Advanced Features

Debugging

Set Debug Level

CleverTap.setDebugLevel(3)

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

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);