flutter sdk

Table of Content

Integration

Add Trackier SDK to your app

Add the SDK

Run this command:

With Flutter:

 $ flutter pub add trackierfluttersdk

This will add a line like this to your package's pubspec.yaml

 dependencies:
  trackierfluttersdk: ^1.0.1

Then navigate to your project in the terminal and run:

  $ flutter packages get

Adding Android install referrer to your app

Add the Android Install Referrer as a dependency. You can find the latest version here

  dependencies {
    // make sure to use the latest SDK version:

    implementation 'com.android.installreferrer:installreferrer:2.2'
  }

Add required permissions

  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

  <!-- Optional : -->
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />

Update Pod Dependencies

For iOS app make sure to go to ios folder and install Cocoapods dependencies:

     $ cd ios && pod install

Implement and initialize the SDK

Retrieve your dev key

Screenshot 2021-08-03 at 3 13 00 PM

Initialize the SDK

Import the following libraries


    import 'package:trackierfluttersdk/trackierfluttersdk.dart';
    import 'package:trackierfluttersdk/trackierconfig.dart';
    import 'package:trackierfluttersdk/trackierevent.dart';

Important: it is crucial to use the correct dev key when initializing the SDK. Using the wrong dev key or an incorrect dev key impact all traffic sent from the SDK and cause attribution and reporting issues.

Inside the class, inside initPlatformState function , initialize SDK

    TrackerSDKConfig trackerSDKConfig = new TrackerSDKConfig("xxxx-xx-4505-bc8b-xx", "production");
    Trackierfluttersdk.initializeSDK(trackerSDKConfig);
  • The first argument is your Trackier Sdk api key.
  • The second argument is environment which can be either “development” and “production”
  • After that pass the sdkConfig reference to TrackierSDK.initialize method.

Assosiate User Info during initialization of sdk

To assosiate Customer Id , Customer Email and Customer additional params during initializing sdk

    TrackierSDK.setUserId("XXXXXXXX");
    TrackierSDK.setUserEmail("abc@gmail.com");
    TrackierSDK.initialize(sdkConfig);

Note

For additional user details , make a map and pass it in setUserAdditionalDetails function.

    var userAdditonalDetail = Map<String, Object>();
    userAdditonalDetail["phoneNumber"] = 9876453210;
    Trackierfluttersdk.setUserAdditonalDetail(userAdditonalDetail);
  • The first method is to associate user Id in which
  • The second method is to associate user email in which

Track Events

Retrieve Event Id from dashboard

Screenshot 2021-08-03 at 3 25 55 PM

Track Simple Event

    TrackierEvent trackierEvent = new TrackierEvent("eventID");
    trackierEvent.orderId = "orderID";
    trackierEvent.param1 = "param1";
    trackierEvent.param2 = "param2";
    trackierEvent.setEventValue("ev1", "eventValue1");
    trackierEvent.setEventValue("ev2", 1);
    Trackierfluttersdk.trackerEvent(trackierEvent);
  • Argument in Trackier event class is event Id which you want to call event for.
  • You can associate inbuilt params with the event , in-built param list are below:- orderId, currency, currency, param1, param2, param3 ,param4, param5, param6, param7, param8, param9, param10

Track with Currency & Revenue Event

    TrackierEvent trackierEvent = new TrackierEvent("eventID");
    trackierEvent.revenue = 10.0;
    trackierEvent.currency = "INR";
    trackierEvent.orderId = "orderID";
    trackierEvent.param1 = "param1";
    trackierEvent.param2 = "param2";
    trackierEvent.setEventValue("ev1", "eventValue1");
    trackierEvent.setEventValue("ev2", 1);
    Trackierfluttersdk.trackerEvent(trackierEvent);

Add custom params with event

    var eventCustomParams = Map<String, Object>();
    eventCustomParams.put("customParam1",XXXXX)
    eventCustomParams.put("customParam2",XXXXX)
    event.ev = eventCustomParams
    TrackierSDK.trackEvent(event)
  • First create a map
  • Pass its reference to event.ev param of event
  • Pass event reference to trackEvent method of TrackerSDK

Proguard Settings

If your app is using proguard then add these lines to the proguard config file

  -keep class com.trackier.sdk.** { *; }
  -keep class com.google.android.gms.common.ConnectionResult {
      int SUCCESS;
  }
  -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
      com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
  }
  -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
      java.lang.String getId();
      boolean isLimitAdTrackingEnabled();
  }
  -keep public class com.android.installreferrer.** { *; }

Libraries

trackierconfig
trackierevent
trackierfluttersdk