Functions
Methods
Initialize
Initializes the SDK. For a complete configuration of the Flutter Intelligence SDK please check Configuration.
initialize(List<int> trackIds, String trackDomain) → Future<String?>
Optional setup functions
/**
* We should use this function to enable batch support
* @size is one batch size (The recommended value is between 500 and 5000)
*/
setBatchSupportEnabledWithSize(bool isEnabled, int size) → Future<String?>
/**
* log level
*/
setLogLevel(LogLevel logLevel) → Future<String?>
/**
* Request Interval: define how often the library sends a request to the server. The minimum is 15 minutes, which is the default
*/
setRequestInterval(int intervalSize) → Future<String?>
/**
* Only iOS function: The number of requests in the queue before write the database
*/
setRequestPerQueue(int requestNumber) → Future<String?>
Build
Builds the SDK. For a complete configuration of the Flutter Intelligence SDK please check Configuration. For Android, please refer to the section Initializing the SDK for Android.
build() → Future<void>
Track
Sends the data to the Mapp tracking server. To see the complete data configuration of the Mapp Intelligence Java library, please check Data. It's possible to send actionEvents and pageViewEvents.
The following data can only be sent via pageViewEvents:
- Page
The following data can be sent only via actionEvents:
- Action
The following information can be sent via both pageViewEvents and actionEvents:
- Campaign
- Customer
- Product
- Order
- Goal
- Session
The following information can be sent in MediaEvents:
- Media
- Action
- Ecommerce
- Session
/**
* @Action(Event) tracking function
* @return void
*/
trackAction(ActionEvent actionEvent) → Future<void>
/**
* @Media tracking function
* @return void
*/
trackMedia(MediaEvent mediaEvent) → Future<void>
/**
* @Page(Screen) trakcing function
* @return void
*/
trackPage(String customName, [Map<String, String>? trackingParameters]) → Future<void>
/**
* @ * @Page(Screen) trakcing function with custom data and PageViewEvent
* @return void
*/
trackPageWithCustomData(PageViewEvent? pageViewEvent, [String? customName]) → Future<void>
/**
* @param url specifies the URL to be tracked. For a complete example of campaign tracking via URLs please refer to Data > Campaign.
* @return boolean
*/
trackUrl(String urlString, String? mediaCode) → Future<void>
Opt-out
/**
* set to true if you want to send the currently cached data before setting the opt-out. Default is false.
*/
optOutAndSendCurrentData(bool value) → Future<void>
Opt-in
/**
* @return void
*/
optIn() → Future<void>
Get EverID
/**
* @return everID
*/
getEverID() → Future<String>
Change TrackID and Track Domain on Runtime
It is possible to change the track ID and track domain on runtime.
/**
* @return everID
*/
PluginMappintelligence.setIdsAndDomain([array String account ID], String track domain);
WebView
For a complete description for tracking WebView data please refer to Data > WebView.
iOS
/**
* Setup function for webview
* only for iOS
*/
trackWebview(double? x, double? y, double? width, double? height, String urlString) → Future<void>
/**
* dispose function for webview
* only for iOS
*/
disposeWebview() → Future<void>
Android
/**
* Import package and use like a standard flutter webview https://pub.dev/packages/webview_flutter/install
*/
import 'package:plugin_mappintelligence/webview_flutter.dart';
Import
import 'package:plugin_mappintelligence/plugin_mappintelligence.dart';
setup
PluginMappintelligence.trackWebview(
0.0,
Scaffold.of(context).appBarMaxHeight ??
MediaQuery.of(context).padding.top + kToolbarHeight,
MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height -
(Scaffold.of(context).appBarMaxHeight ??
MediaQuery.of(context).padding.top + kToolbarHeight),
'http://demoshop.webtrekk.com/web2app/index.html');
Import
import 'package:plugin_mappintelligence/webview_flutter.dart';
setup
return Scaffold(
appBar: AppBar(
title: Text('WebviewForAndroid'),
),
body: WebView(
initialUrl: 'http://demoshop.webtrekk.com/web2app/index.html',
javascriptMode: JavascriptMode.unrestricted,
}),
);
Send Request Immediately (Android only)
Due to the use of the WorkManager, Android is limited in terms of the scheduled sending of requests. As long as the app is used in the foreground, it is possible to trigger the sending of requests on any event trigger.
/**
* Call on any event in app
*/
PluginMappintelligence.sendAndCleanData()
Reset Singleton
For testing purposes it is helpful to be able to reset the Intelligence singleton. Resetting the singleton will reset the SDK configuration to its default values.
/**
* Call on any event in app
*/
PluginMappintelligence.reset()