thunderheadone / one-sdk-flutter

Thunderhead Flutter Plugin for apps built using Flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

one-sdk-flutter

The Thunderhead ONE SDK Flutter Plugin for iOS and Android.

Examples

To see integration examples, see examples.

Installation

To install the Thunderhead ONE Flutter Plugin, go to your pubspec.yaml and add the dependency:

one_sdk_flutter:
  git:
    url: https://github.com/thunderheadone/one-sdk-flutter.git

Disable automatic Interaction detection

By disabling automatic Interaction detection, the SDK will no longer automatically send Interaction requests as native iOS View Controllers or Android Activities or Fragments are presented on screen.

It is recommended to disable automatic Interaction detection in Flutter applications as the SDK does not recognize Flutter or web view elements, so it becomes your responsibility to send them when needed by using the send Interaction methods outlined below.

For native applications where only a part of the app uses Flutter, you may want to ignore disabling automatic Interaction detection to automatically detect native Interactions.

You can disable automatic Interaction detection by calling the method disableAutomaticInteractionDetection: and passing true as a parameter, as shown below:

// Swift
One.disableAutomaticInteractionDetection(true)
// https://github.com/thunderheadone/one-sdk-ios#disable-automatic-interaction-detection
// Kotlin
oneConfigureCodelessInteractionTracking {
    // disables Fragment/Activity Interaction Tracking
    disableCodelessInteractionTracking = true 
}
// https://github.com/thunderheadone/one-sdk-android#disable-automatic-interaction-detection

An appropriate place to call the method might be under didFinishLaunchingWithOptions in your AppDelegate for iOS or under onCreate in your Application class for Android.

You can set this back to false at any point to restart automatic Interaction detection.

Usage

Initialization

To initialize the ONE Flutter Plugin, call the following method:

import 'package:one_sdk_flutter/one_sdk_flutter.dart';

One.initializeOne(SITE_KEY, TOUCHPOINT, API_KEY, SHARED_SECRET, USER_ID, HOST, false);
  • See example of usage here

Send an Interaction

To send an Interaction request without properties, call the following method:

One.sendInteraction("/interactionPath");
  • See example of usage here

To send an Interaction request with properties, call the following method:

One.sendInteraction("/interactionPath", { 'key' : 'value' });
  • See example of usage here

To send an Interaction request and retrieve the response, call the following method:

One.sendInteraction("/interactionPath").then((response) {
    print('Interaction response tid = ${response[oneResponseTidKey]}');
    print('Interaction response Interaction path = ${response[oneResponseInteractionPathKey]}');
    print('Interaction response optimization points = ${response[oneResponseOptimizationPointsKey]}');
});
  • See example of usage here

Send a response code

To send a response code, call the following method:

One.sendResponseCode("code", "/interactionPath");

Opt an end-user out of tracking

To opt an end-user out of all tracking options, when the end-user does not give permission to be tracked in the client app, call the following method:

// Opts out of all tracking options.  
One.optOut(true);

To opt back in, call the following method:

// Opt in for all tracking options.
One.optOut(false);

Opt an end user out of city country level tracking

To opt an end-user out of city/country level tracking, call the following method:

// Calling this method will opt the end-user back in for all tracking. 
One.optOutCityCountryDetection(true);

Opt an end user out of keychain Tid storage (iOS only)

To opt an end-user out of all keychain Tid storage, call the following method:

One.optOutKeychainTidStorage(true);

Access debug information

To configure logging, call the following method:

One.setThunderheadLogLevel(true);
  • See example of usage here

Questions or need help

Thunderhead ONE Support

The Thunderhead team is available 24/7 to answer any questions you have. Just email onesupport@thunderhead.com or visit our docs page for more detailed installation and usage information.

Salesforce Interaction Studio Support

For Salesforce Marketing Cloud Interaction Studio questions, please submit a support ticket via https://help.salesforce.com/home

About

Thunderhead Flutter Plugin for apps built using Flutter


Languages

Language:Objective-C 43.2%Language:Java 39.9%Language:Dart 14.3%Language:Ruby 2.6%