Global Configuration
    • 3 Minutes to read
    • Dark
      Light

    Global Configuration

    • Dark
      Light

    Article summary

    You can modify the global configuration of the Mapp Android SDK. If no custom configurations are provided, the default settings will be applied.

    Recommended Settings

    We recommend enabling batch support and using the client timestamp in your account to improve data quality. Please contact your account manager to enable client timestamp support in your Mapp Intelligence account.

    Configuration Options

    The webtrekkConfiguration class contains several configuration attributes that you can adjust according to your needs:

    class WebtrekkConfiguration private constructor(
        override val trackIds: List<String>,
        override val trackDomain: String,
        override val logLevel: Logger.Level,
        override val requestsInterval: Long,
        override val autoTracking: Boolean,
        override val fragmentsAutoTracking: Boolean,
        override val workManagerConstraints: Constraints,
        override val okHttpClient: OkHttpClient,
        override val requestPerBatch: Int,
        override val batchSupport: Boolean,
        override val activityAutoTracking: Boolean
    	override val exceptionLogLevel: ExceptionType,
        override val shouldMigrate: Boolean,
        override val versionInEachRequest: Boolean,
        override val everId: String?
    	override var userMatchingEnabled: Boolean,
    )

    Attribute

    Description

    Default

    trackIds

    Mandatory. The Track ID is used to generate the correct request URL.

    blank

    trackDomain

    Mandatory. The Track Domain is used to generate the correct request URL

    blank

    logLevel

    Optional. Set the logging level. Recommended for debugging only, not in production. Values: NONE, BASIC.

    NONE

    requestsInterval

    Optional. Sets the interval (in minutes) for sending cached tracking data. Default setting is 15 min. If you would like to initiate a request, you can also use  sendRequestsNowAndClean

    15

    autotracking

    Optional. Automatically tracks activity/fragment page names. Recommended to disable in production.

    Enabled

    fragmentsAutoTracking

    Optional. Disables automatic page name tracking for fragments only.

    Enabled

    workManagerConstraints

    Optional. Defines WorkManager constraints, see WorkManager.

    -

    okHttpClient

    Optional. Customizes the OkHttpClient for certificates, interceptors, etc., see OkHttpClient Builder.

    -

    requestPerBatch

    Optional. Sets the number of requests per batch. Maximum: 10,000.

    5000

    BatchSupport

    Optional. Enables sending requests in batches instead of individually. Recommended for better performance. See Batch Support.

    Disabled

    ActivityAutoTracking

    Optional. Disables automatic tracking for activities only.

    Enabled

    exceptionLogLevel

    Optional. Supports crash tracking analysis. See Crash Tracking

    NONE

    shouldMigrate

    Optional. Enables migration from SDK version 4 to 5 without losing customer everID data (available from version 5.0.3 onwards).

    Disabled

    versionInEachRequest

    Optional. Sends the app version with each request instead of just once per session.

    Disabled

    everId

    Optional. Manually sets the everID; if left blank, one will be generated by the SDK.

    Disabled

    userMatchingEnabled

    Optional. Enables user matching between Engage and Intelligence SDKs for better targeting. See Android User Matching.

    Disabled

    Configuration Methods

    Method

    Description

    logLevel(logLevel: Logger.level)

    Overrides the default logLevel.

    requestInterval(timeUnit: TimeUnit = TimeUnit.MINUTES, interval: Long)

    Overrides the default request interval. The minimum interval is 15 minutes.

    disableAutoTracking(Boolean)

    Disables auto-tracking for both activities and fragments. See Automatic Tracking.

    true = Auto tracking is disabled.

    disableActivityAutotracking(Boolean)

    Disables auto-tracking for activities only. See Automatic Tracking.

    setBatchSupport(batchEnable: Boolean,requestsInBatch: Int = DefaultConfiguration.REQUEST_PER_BATCH)

    Enables batch support with customizable requests per batch. Maximum: 10,000.

    disableFragmentsAutoTracking(Boolean)

    Disables auto-tracking for fragments only. See Automatic Tracking.

    workManagerConstraints(constraints: Constraints)

    Sets WorkManager constraints. See WorkManager

    okHttpClient(okHttpClient: OkHttpClient)

    Sets a custom OkHttpClient. See OkHttpClient Builder

    enableCrashTracking(exceptionLogLevel: ExceptionType)

    Overrides the default exception type.

    enableMigration()

    Enables migration from SDK version 4 to 5 without losing everID data.

    sendAppVersionInEveryRequest()

    Sends the app version in every request. If disabled, it is only sent if the SDK starts a new session, which might lead to inconsistencies in your analyses.

    setEverId()

    This function can be used to set the Everid via configuration, instead of using the one generated during initialization. If left blank, one will be generated.

    Webtrekk.reset(context,config)

    Resets the SDK while it’s active.

    setUserMatchingEnabled(Boolean)

    Overrides the default user matching configuration.

    Example Usage

    Below are examples of how to apply the configuration in an Application class using both Java and Kotlin. It demonstrates how to configure logging, batch support, custom request intervals, and auto-tracking settings within your app.

    class SampleApplication : Application() {
     
         override fun onCreate() {
             super .onCreate()
     
             val webtrekkConfigurations =
                 WebtrekkConfiguration.Builder(listOf( "track Id" ), "track domain" )
                     .logLevel(Logger.Level.BASIC)
    				 .setEverId("149830287648938")
                     .enableCrashTracking(ExceptionType.ALL)
                     .requestsInterval(TimeUnit.MINUTES, 15 )
                     .disableAutoTracking()
                     .enableMigration()
                     .setBatchSupport( true , 10000 )
                     .sendAppVersionInEveryRequest()
                     .build()
     
             Webtrekk.getInstance().init( this , webtrekkConfigurations)
         }
    }
    public class SampleApplication extends Application {
     
         @Override
         public void onCreate() {
         super .onCreate();
     
         List<String> trackIds = new ArrayList<>();
         trackIds.add( "track id" );
     
         WebtrekkConfiguration webtrekkConfiguration = new WebtrekkConfiguration.Builder(trackIds, "track domain" )
    		.setLogLevel(Logger.Level.BASIC)
    		.setEverId("149830287648938")
    		.setExceptionType(ExceptionType.ALL)
    		.setRequestsInterval(TimeUnit.MINUTES, 15 )
    		.setBatchSupport( true , 10000 )
    		.enableMigration()
    		.disableAutoTracking()
    		.sendAppVersionInEveryRequest()
    		.build();
     
         Webtrekk.getInstance().init( this , webtrekkConfiguration);
       }
    }


    Was this article helpful?

    What's Next