It is possible to change the global configuration. Otherwise, the default configuration is used.


Configuration Options

We highly recommend to enable batch support and use the client timestamp in your account for page duration calculation to increase data quality. Please contact your account manager to enable client timestamp support in your account.

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?
)
JAVA
AttributeDescriptionDefault
trackIdsMandatory. The track id is used to generate the correct request URL.blank
trackDomainMandatory. The track domain is used to generate the correct request URLblank
logLevel

Optional. Used to log data generated by the SDK for debugging purposes. We do not recommend to enable it in production. Possible values are:

NONE = Logging is disabled.

BASIC = Logging is enabled.

NONE
requestsInterval

Optional. This parameter defines the periodic time for sending the cached tracking data to the Mapp server. This is set to 15 min by default. If you want a different transmission interval, you can overwrite the default setting here. If you would like to initiate a request, you can also use sendRequestsNowAndClean

15
autotracking

Optional. When enabled, the class name of the activity and any fragment included are used to generate the page name of the screen. It is possible to disable autotracking for fragments or activities individually or keep autotracking on for both. We recommend to disable autotracking in production.

Enabled
fragmentsAutoTrackingOptional. When autotracking is enabled, it is possible to disable automatic page name declaration for fragments only.Enabled
workManagerConstraintsOptional. You can set WorkManager parameters according to your needs, see WorkManager.-
okHttpClientOptional. You can adjust the okHttpClient used in the SDK, to setup certificates pinning, interceptors, etc., see OkHttpClient Builder.-
requestPerBatchOptional. When batch support is enabled, you can adjust the number of requests per batch. The maximum number of requests per batch allowed is 10000.5000
BatchSupportOptional. When batch support is enabled, the requests are sent to the server in batches instead of individually. It is recommended to enable batch support, see Batch Support.Disabled
ActivityAutoTrackingOptional. When autotracking is enabled, it is possible to disable automatic page name declaration for activities only.Enabled
exceptionLogLevelOptional. Supports various types of Crash Tracking analyses.NONE
shouldMigrateOptional. Enable if you want to migrate from SDK version 4 to SDK version 5 without losing customer everID data. (Available from version 5.0.3 onwards)Disabled
versionInEachRequestOptional. Enable if you like to send the version in each request instead of once per session.Disabled
everIdOptional. Use if you want to set your own everID instead of having one created by the SDK.Disabled

Methods

MethodDescription
logLevel(logLevel: Logger.level)Overrides the default logLevel.

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

Overrides the default requestInterval.

Please note that the minimum time interval is 15 minutes. You can, therefore, only set a time interval of 15 minutes or more.

disableAutoTracking(Boolean)

Disables autotracking. Read also the chapter Automatic Tracking.

true = Auto tracking is disabled.

disableActivityAutotracking(Boolean)Disables autotracking of activities only (not needed when autotracking is already disabled). Read also the chapter Automatic Tracking.
setBatchSupport(batchEnable: Boolean,requestsInBatch: Int = DefaultConfiguration.REQUEST_PER_BATCH)Configures batch support. Sets batch support to "true" and gives the option to configure the amount of requests per batch. Leaves default amount of requests per batch if nothing is specified.
disableFragmentsAutoTracking(Boolean)Disables autotracking of fragments only (not needed when autotracking is already disabled). Read also the chapter Automatic Tracking.

workManagerConstraints(constraints: Constraints)

Specifies workManager constraints. See WorkManager for further information.

okHttpClient(okHttpClient: OkHttpClient)

Used to adjust the okHttpClient. See OkHttpClient Builder for further information
enableCrashTracking(exceptionLogLevel: ExceptionType)Overrides the default exception type.
enableMigration()Keeps customer everID data when migrating from SDK version 4 to SDK version 5.

sendAppVersionInEveryRequest()

Sends the default app version parameter 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 you use the function but leave the String empty, the SDK will generate one as usual.
Webtrekk.reset(context,config)Allows you to restart and reset the SDK while it is active.

Example




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)
     }
}
JAVA







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);
   }
}
JAVA