Unity Advanced Features

Advanced Features

πŸ“˜

Note

If you are using Unity SDK v3.0.0, use Clevertap instead of ClevertapBindings method.

Debugging

Set Debug Level

CleverTapBinding.SetDebugLevel(3);

Native Display

On Display Units Loaded

CleverTap.addListener(CleverTap.CleverTapDisplayUnitsLoaded, (event) => {
        _handleCleverTapDisplayUnitsLoaded(CleverTap.CleverTapDisplayUnitsLoaded, event);
    });

function _handleCleverTapDisplayUnitsLoaded(eventName, event) {
    console.log('CleverTap Display Unit Event - ', eventName, event);
}

Get All Display Units

function _handleCleverTapDisplayUnitsLoaded(eventName, event) {
    console.log('CleverTap Display Unit Event - ', eventName, event);
    CleverTap.getAllDisplayUnits((err, res) => {
        console.log('All Display Units: ', res, err);
    });
}

Display unit viewed event for ID

CleverTap.pushDisplayUnitViewedEventForID('Display Unit Id');

Display unit clicked event for ID

CleverTap.pushDisplayUnitClickedEventForID('Display Unit Id');

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