lemnisk_plugin

This project is the Lemnisk Plugin for track events, capture screen view, identify users on Flutter based Apps, it is also integrated with following destinations in device mode:

  1. GA4
  2. AppsFlyer
  3. Clevertap

Getting Started

import 'package:lemnisk_plugin/AttributeBuilder.dart';
import 'package:lemnisk_plugin/LemniskFlutterCore.dart';
import 'package:lemnisk_plugin/LemniskHelper.dart';

LemniskHelper.configure(SERVER_URL, WRITE_KEY, lemniskFirebaseCore, lemniskApsflyer, lemniskCleverTapCore);

Check the examples below track events, capture screen view, identify users on Flutter based Apps:

void getIdentify() {
  AttributeBuilder attributeBuilder = AttributeBuilder();
  attributeBuilder.properties['key1'] = 'value1';
  attributeBuilder.properties['key2'] = 'value2';
  attributeBuilder.properties['lat'] = 13.291860;
  attributeBuilder.properties['long'] = 77.751808;

  OtherBuilder otherBuilder = OtherBuilder();
  otherBuilder.otherid['otherId'] = 'otherId_value';

  LemniskHelper.identify("user_id", attributeBuilder, otherBuilder);
}

void getScreen() {
  AttributeBuilder attributeBuilder = AttributeBuilder();
  attributeBuilder.properties['key1'] = 'value1';
  attributeBuilder.properties['key2'] = 'value2';

  OtherBuilder otherBuilder = OtherBuilder();
  otherBuilder.otherid['otherId'] = 'otherId_value';

  LemniskHelper.screen("MainActivity", attributeBuilder, otherBuilder);
}

void getTrack() {
  AttributeBuilder attributeBuilder = AttributeBuilder();
  attributeBuilder.properties['properties'] = 'material';
  attributeBuilder.properties['button'] = 'Track event from different app';

  OtherBuilder otherBuilder = OtherBuilder();
  otherBuilder.otherid['trackerId'] = '6791c47a-0178-47bc-8711-86a2c67b2255';

  LemniskHelper.track("MainDartFile", attributeBuilder, otherBuilder);
}

For Clevertap Destination Integration, please add following configuration:

Android:

Please add below config after replacing value with actual Clevertap Account id, Token in 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:

Please add below config after replacing value with actual Clevertap Account id, Token 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:

Android:

Please add 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:

then add below code after replacing 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:

Also this Appsflyer SDK object can be used for Unified deep linking:

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