Before you can start tracking your app, the iOS tracking library must be integrated into your application project through CocoaPods or Carthage. In either case, you have to provide the configuration file “webtrekk_config.xml” in the main bundle of your application.

Preparing CocoaPods or Carthage

To use CocoaPods, add the following line to your project's Podfile:

pod 'Webtrekk' , '~ > 4.1 5.1 3 '
JAVA


To use Carthage, add the following line to your Cartfile:

github "Webtrekk/webtrekk-ios-sdk" ~ > 4.1 5.1 3
JAVA



Our iOS SDK library is hosted at the following distribution platform: iOS Tracking Library.

Basic Configuration in Tag Integration

The implementation of the app tracking is realized through Mapp Tag Integration. Please refer to the chapter Basic Implementation for details.

The "webtrekk_config.xml" file contains the required configuration that you have made as the basic configuration in Tag Integration (see step 3). To send tracking requests to your Mapp Intelligence account, you must integrate this XML file into your SDK.

Download this file as described here to provide it in the main bundle of your application. Alternatively, you can also change the path for the configuration file (step 4).

In some cases you receive this configuration file initially from our support team; it is then preconfigured individually for you.


Example "webtrekk_config.xml"

<? xml version = "1.0" encoding = "UTF-8" ?>
< webtrekkConfiguration >
   < version >44</ version >
   < trackId >123451234512345</ trackId >
   < trackDomain >https://q3.webtrekk.net</ trackDomain >
   < sampling >0</ sampling >
   < sendDelay >3</ sendDelay >
   < maxRequests >4000</ maxRequests >
   < resendOnStartEventTime >30</ resendOnStartEventTime >
   < autoTracked >false</ autoTracked >
   < autoTrackAppUpdate >true</ autoTrackAppUpdate >
   < autoTrackAdvertiserId >true</ autoTrackAdvertiserId >
   < autoTrackAppVersionName >true</ autoTrackAppVersionName >
   < autoTrackAppVersionCode >true</ autoTrackAppVersionCode >
   < autoTrackRequestUrlStoreSize >true</ autoTrackRequestUrlStoreSize >
   < autoTrackAppPreInstalled >true</ autoTrackAppPreInstalled >
   < autoTrackApiLevel >true</ autoTrackApiLevel >
   < autoTrackScreenOrientation >true</ autoTrackScreenOrientation >
   < autoTrackConnectionType >true</ autoTrackConnectionType >
   < autoTrackAdvertisementOptOut >true</ autoTrackAdvertisementOptOut >
   < autoTrackPlaystoreUsername >false</ autoTrackPlaystoreUsername >
   < autoTrackPlaystoreMail >false</ autoTrackPlaystoreMail >
   < enableRemoteConfiguration >true</ enableRemoteConfiguration >
   < trackingConfigurationUrl >https://d1r27qvpjiaqj3.cloudfront.net/1111111111111111/36818.xml</ trackingConfigurationUrl >
   < globalTrackingParameter >
     < parameter id = "INTERN_SEARCH" key = "AT1" />
     < pageParameter >
       < parameter id = "1" key = "TP1" />
       < parameter id = "2" >ConstParam1</ parameter >
     </ pageParameter >
     < pageCategories >
       < parameter id = "1" key = "PageCatKey" />
       < parameter id = "2" key = "TrainingNewParameterKey" />
     </ pageCategories >
   </ globalTrackingParameter >
   < screen >
     < classname type = "text" >com.webtrekk.webtrekksdk.training.MainActivity</ classname >
     < mappingname type = "text" >MainName</ mappingname >
     < autoTracked >false</ autoTracked >
   </ screen >
   < screen >
     < classname type = "text" >com.webtrekk.webtrekksdk.training.ComplexActivity</ classname >
     < mappingname type = "text" >CustomPage1</ mappingname >
     < autoTracked >false</ autoTracked >
   </ screen >
   < screen >
     < classname type = "text" >com.webtrekk.webtrekksdk.training.SimpleActivity</ classname >
     < mappingname type = "text" >SimpleName</ mappingname >
     < autoTracked >true</ autoTracked >
     < screenTrackingParameter >
       < pageParameter >
         < parameter id = "5" key = "TP1" />
         < parameter id = "1" key = "TP2" />
         < parameter id = "1" key = "AT2" />
       </ pageParameter >
       < ecomParameter >
         < parameter id = "1" key = "TP1" />
       </ ecomParameter >
     </ screenTrackingParameter >
   </ screen >
   < errorLogEnable >true</ errorLogEnable >
   < errorLogLevel >3</ errorLogLevel >
   < autoTrackAdClearId >true</ autoTrackAdClearId >
   < recommendations >
     < recommendation name = "complexReco" >https://reco.webtrekk.com/dmp/recos/v1/?accountId=238713152098253&placementId=39876</ recommendation >
   </ recommendations >
</ webtrekkConfiguration >
JAVA



Please make sure that the parameter "enableRemoteConfiguration" in the XML file is set to TRUE. This is the only way for all other settings and changes made in Tag Integration to take effect.


Change Path for the Configuration File

If you do not want to deploy the configuration file directly to your main bundle and want to use a separate folder for your project structure instead, you must call the "initTrack" method with the path to your configuration file.

Example

import UIKit
import Webtrekk
 
@UIApplicationMain
class AppDelegate: NSObject, UIApplicationDelegate {
  var window: UIWindow ?
 
   func application(
    application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any] ? ) - > Bool {
 
    guard
    let configFile = Bundle( for : ViewController.self).url (forResource: "webtrekk_config" , withExtension: "xml" )
    else {
     fatalError( "Cannot locate webtrekk_config.xml" )
    }
 
    try ! WebtrekkTracking.initTrack(configurationFile)
    return true
   }
}
JAVA

With these basic settings, the functionality of the SDK is now available to you. By enabling autotracking and providing all necessary view controllers, you have already implemented full view controller tracking and are now sending initial requests to your Mapp Intelligence account.