Initializing the Tracking Functionality
    • 1 Minute to read
    • Dark
      Light

    Initializing the Tracking Functionality

    • Dark
      Light

    Article summary

    To initialize the tracking functionality, you have to perform the following steps:

    Implementation Options

    First, import the tracking classes to be able to use them in your source code.

    import Webtrekk

    Our tracking functionality is provided via the class "Webtrekk."

    It is implemented as "singleton" and has to be initialized once. We recommend doing that in the "application" method of your AppDelegate.

    Example

    import UIKit
    import Webtrekk
     
    @UIApplicationMain
    class AppDelegate: NSObject, UIApplicationDelegate {
      var window: UIWindow ?
     
       func application(
         application: UIApplication,
         didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject] ? ) - > Bool {
     
         try !WebtrekkTracking.initTrack()
         return true
       }
    }

    First, import the tracking classes to be able to use them in your source code.

    import com.webtrekk.webtrekksdk.Webtrekk;

    Our tracking functionality is provided via the class "Webtrekk."

    It is implemented as "singleton" and has to be initialized once. We recommend doing that in the "onCreate" method of your MainActivity.

    Example

    private Webtrekk webtrekk;
     
    @Override
    protected void onCreate(Bundle savedInstanceState) {
         super .onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
     
         webtrekk = Webtrekk.getInstance();
         webtrekk.initWebtrekk(getApplication());
    }

    If you have made all required settings as described in the section " Configuring the App Tracking" the tracking functionality is now available. Initial requests can now be sent to your Mapp Intelligence account.


    Was this article helpful?