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
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.
Updated 11 months ago