Functions
    • 4 Minutes to read
    • Dark
      Light

    Functions

    • Dark
      Light

    Article summary

    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?>

    JAVA

    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 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

    • E-commerce

    • 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>

    Deep link

    Deep Link tracking allows you to analyze campaigns that are deep linked to a screen of your mobile app.

    /**
    
     * @param url specifies the URL to be tracked. Please note that you need to use the campaign format used by Mapp Intelligence.
    
     * @return void
    
     */
    
    trackUrl(String urlString, String? mediaCode) → Future<void>
    
    
    /**
    
     * Campaign that uses "wt_mc" as media code.
    
    */
    
    buttons.add(ElevatedButton(
    
          onPressed: () async {
    
            var urlString =
    
                "https://testurl.com/?wt_mc=email.newsletter.nov2020.thursday&wt_cc45=parameter45";
    
            PluginMappintelligence.trackUrl(urlString, null);
    
            String className = this.runtimeType.toString();
    
            PluginMappintelligence.trackPageWithCustomData(null, className);
    
          },
    
          child: Text('Test Link1'),
    
          style:
    
              ElevatedButton.styleFrom(primary: Theme.of(context).primaryColorDark),
    
        ));
    
    /**
    
     * Campaign that uses a custom media code.
    
    */
    
        buttons.add(ElevatedButton(
    
          onPressed: () async {
    
            var urlString =
    
                "https://testurl.com/?customMc=email.newsletter.nov2020.thursday&wt_cc12=parameter12";
    
            PluginMappintelligence.trackUrl(urlString, "customMc");
    
            String className = this.runtimeType.toString();
    
            PluginMappintelligence.trackPageWithCustomData(null, className);
    
          },
    
    

    Anonymous Tracking

    With anonymous tracking it is possible to track usage of the mobile application without a persistent tracking of a user across sessions. When anonymous tracking is enabled, the default user identifier is not set. It is possible to set a temporary session ID to provide a better data quality during session tracking. The temporary session ID identifies requests from the same session.

    /**
    
     * Anonymous tracking can be called on initialization or during runtime.
    
    */
    
    // Enable anonymous tracking. If needed, include a String of additional parameters to be excluded from tracking if anonymous tracking is enabled.  
    setAnonymousTracking(bool enabled, List <String>) -> Future<void>
    
    // Set a temporary session ID.
    
    setTemporarySessionId(<String>) -> Future<String>

    User Matching

    User Matching allows you to use Intelligence analytics data to better target users via mobile push or in App messages in Engage.

    /**
    
     * User matching only works if anonymous tracking is inactive. It is possible to set user matching on initialisation as well as on runtime.
    
    */
    
    setUserMatchingEnabled(bool enabled) → 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 of 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 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.

    PluginMappintelligence.sendAndCleanData()

    Print Current Configuration

    While testing and debugging the configuration, it can be helpful to print out the currently active global configuration to the console.

    PluginMappintelligence.getCurrentConfig()

    Reset Singleton

    For testing purposes, it's helpful to be able to reset the Intelligence singleton. Resetting the singleton will reset the SDK configuration to its default values.

    PluginMappintelligence.reset()


    Was this article helpful?