Clevertap

Getting started with Clevertap and setting it up

Once the Lemnisk SDK is integrated, share your CleverTap account ID and CleverTap account token with the Lemnisk customer success manager. You can find the account ID and account token in the CleverTap Dashboard under Settings.

Connection

ConnectionWebMobile

​📱Device Mode

​✅

​✅ (Only Flutter SDK)

☁️Cloud Mode

Please note that the data being sent using cloud mode would be portrayed as though it were coming from the desktop on CleverTap Dashboard as technographic are only supported in device mode in CleverTap.

Methods

Track

When a trackevent is triggered, it is sent as Clevertap Custom Events along with its properties. You need to know that arrays or nested objects for custom track event properties are not supported in Clevertap.

Charged Event

A charged event is a special event that tracks/ records transactions or purchases. They provide transaction details such as the transaction id, transaction information, their categories and so on about the users.

Every purchase marked as a customer in CleverTap helps you differentiate between customer and non-customer.

You can refer to this doc to know more about Charged Events in CleverTap.

We can map the event and event properties of your choice to Charged Event and its properties. Contact us for the same.

Please note that this track event can contain arrays and nested objects.

Identify

In CleverTap, every identified user profile has its own ID. However, we can add other IDs such as email, fbid etc., to identify a user. The user ID that you send via identify call is mapped to Clevertap Identity.

The following user properties will be automatically mapped to CleverTap default user properties:

LemniskCleverTap

email

Email

phone

Phone

fbid (Only for Flutter SDK)

FBID

Any user ID passed as a parameter in the identify call

Identity

Except for the above properties, all the other user properties will be sent as custom properties.

Page

Flutter:

The page() calls and custom properties are sent as an equivalent event called Web Page Viewed: <page_name> to CleverTap.

Web:

The page() calls and custom properties are sent as an equivalent event called page to CleverTap.

Screen

The screen() calls and custom properties are sent as an equivalent event called Screen Viewed: <screen_name> to CleverTap.

Add Clevertap to Flutter SDK

  1. Follow the steps to initialize the SDK here.

  2. Add the following configuration in main.dart file:

Dart:

main.dart
//Clevertap params
LemniskCleverTapCore lemniskCleverTapCore = LemniskCleverTapCore(
  enable: true,
  isDebug: true
);

Android:

Please add below dependency in build.gradle file of your App:

build.gradle
implementation 'com.clevertap.android:clevertap-android-sdk:4.4.0'

Please add below config after replacing value with actual Clevertap Account id, Token in AndroidManifest.xml:

AndroidManifest.xml
<meta-data
android:name="CLEVERTAP_ACCOUNT_ID"
android:value="XXX-XXX-XXXX"/>
<meta-data
android:name="CLEVERTAP_TOKEN"
android:value="XXX-XXX-XXX"/>
<meta-data
android:name="CLEVERTAP_USE_GOOGLE_AD_ID"
android:value="1"/>

In you app's Application class, add following line inside onCreate:

public class MyApplication extends FlutterApplication {
        @java.lang.Override
        public void onCreate() {
           //Add below line.
            ActivityLifecycleCallback.register(this);
            super.onCreate();
        }
}

If your app does not have Application class, add this to your AndroidManifest.xml file:

<application
        android:label="@string/app_name"
        android:icon="@drawable/ic_launcher"
        android:name="com.clevertap.android.sdk.Application
/>

iOS:

Please add below config in Info.plist

i. Add property CleverTapAccountID as String and set it's value.

ii. Add property CleverTapToken as String and set it's value. For Sending Push Notifications via Clevertap:

Please add the below config in AndroidManifest.xml:

<service android:name="com.clevertap.android.sdk.pushnotification.fcm.FcmMessageListenerService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

Common in Flutter App:

Add the below code after replacing the token with actual push token, channelId, channelName, channelDescription:

LemniskHelper.setPushToken("token");

    if(Platform.isIOS) {
      CleverTapPlugin.registerForPush();
    }
    CleverTapPlugin.setPushToken("token");
    if (Platform.isAndroid) {
      CleverTapPlugin.createNotificationChannel(
          "channelId", "channelName", "channelDescription", 3, true);
    }

For Clevertap sinking data automatically to Appsflyer:

This Appsflyer SDK object can be used for Unified deep linking.

var appsflyerSdk = LemniskHelper.getAppsFlyerSdk();
CleverTapPlugin.getCleverTapID().then((ctId) => appsflyerSdk?.setCustomerUserId(ctId!));

Add Clevertap to React Native SDK

Step 1: Add the Lemnisk React Native dependency to your project by using the following command:

npm install --save lemnisk-react-native-clevertap@0.0.5

Step 2: Import the SDK wherever you'd like to use it in your react code base:

import LemniskSdk from 'lemnisk-react-native-clevertap';

Please follow below steps in addition to steps documented here but use above npm dependency instead of 'lemnisk-react-native'.

Step 3: To enable Clevertap as the destination., add the following method call (Please call this from your react-native initialization module. If you call this for both Android and iOS then Clevertap initialization in AppDelegate is not required for iOS)

LemniskSdk.configureClevertap(true)

Android:

Please add below dependency in build.gradle file of your App:

build.gradle
implementation 'com.clevertap.android:clevertap-android-sdk:4.0.0'

Please add below config after replacing value with actual Clevertap Account id, Token in AndroidManifest.xml:

AndroidManifest.xml
<meta-data
android:name="CLEVERTAP_ACCOUNT_ID"
android:value="XXX-XXX-XXXX"/>
<meta-data
android:name="CLEVERTAP_TOKEN"
android:value="XXX-XXX-XXX"/>
<meta-data
android:name="CLEVERTAP_USE_GOOGLE_AD_ID"
android:value="1"/>

iOS:

Step 1: Add below dependencies in your Podfile. If you don't want to enable Push Notifications through Lemnisk SDK, you can skip this step.

platform :ios, 'YOUR_TARGET_PLATFORM_VERSION'

target 'YOUR_TARGET_NAME' do  
  use_frameworks!
    
end


target 'NotificationContentExtension' do
  use_frameworks!

  # Lemnisk Notification Content Extension
  pod 'Lemnisk-NotificationContent', '3.8.2'
end

target 'NotificationServiceExtension' do
  use_frameworks!

  # Lemnisk Notification Service Extension
  pod 'Lemnisk-NotificationService', '3.8.2'
end

Step 2: Run the below command

pod install

Note: If you are running this for the first time then you may need to update the pod repositories by running:

pod install --repo-update

Step 3: Add the below config in Info.plist

i. Add property CleverTapAccountID as String and set its value.

ii. Add property CleverTapToken as String and set its value.

Step 4: Add the below Line in didFinishLaunchingWithOptions function of AppDelegate.swift

Step 5: Add the below Clevertap Initialisation line in addition to the existing Lemnisk initialisation.

Lemnisk.shared.configureClevertap(isDebug: true)

After adding the above Clevertap initialisation, your AppDelegate.Swift should look like the following:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
    // Your code

    // Use the following App Groups set method, only if you are using the App Push Notifications from Lemnisk, otherwise please ignore this line.
    [[Lemnisk shared] setAppGroupIDWithGroupId:@"your app groupid"];  // This will be like co.lemnisk.app.ios.bankingdemo, which needs to be either created from Xcode or Apple Developer Account in the App Groups section

    // Initialize Lemnisk SDK
    [[Lemnisk shared] configureWithWriteKey:@"writeKey" serverUrl:@"xx-pl.lemnisk.co" enablePush:true];

    // Initialize Clevertap SDK    
    // Call this method to initialize Clevertap, only if you aren't initializing this from your React-Native module
    [[Lemnisk shared] configureClevertapWithIsDebug:false]; // set to true if you want to see the Clevertap debug logs

    // Your code
  }

Note:

  1. Lemnisk account manager will provide you with the values for writeKey and serverUrl.

  2. In the Clevertap Initialisation line, you can pass true/false to enable/Disable the debug logs.

Last updated