Initialization
The entry point where you can set up all your configurations used by the SDK is
webtrekkConfiguration
.
It is mandatory to add at least one trackID and your trackdomain to start sending track requests to Mapp Intelligence. With the basic configuration as shown in the example, the SDK initialises tracking using the default global configuration as given by the SDK.
We recommend that you define the configurations in the Application class.
Attributes
class WebtrekkConfiguration private constructor(
override val trackIds: List<String>,
override val trackDomain: String,
)
Attribute | Description |
---|---|
trackId | Mandatory. Enter your Track ID(s), which is provided by Mapp. You can provide more than one Track ID if necessary. How to get the tracking ID
|
trackDomain | Mandatory. Enter your Mapp tracking domain (URL). Please be aware that SSL support is mandatory. Example trackDomain = "https://<trackingserver>" |
Example
First, get an instance of Mapp with Webtrekk.getInstance()
.
Then, specify the context and Mapp configurations to Webtrekk.getInstance().init(this, webtrekkConfigurations)
.
Please be aware that without context or configurations, Mapp will throw IllegalStateException upon invoking any method.
class SampleApplication : Application() {
override fun conCreate() {
super .onCreate()
val webtrekkConfigurations =
WebtrekkConfiguration.Builder(listOf( "111111111111111,222222222222222" ), "https://your-trackdomain.com/" )
.build()
Webtrekk.getInstance().init( this , webtrekkConfigurations)
}
}
public class SampleApplication extends Application {
@Override
public void onCreate(){
super .onCreate();
List<String> trackIds = new ArrayList<>();
trackIds.add( "111111111111111" );
trackIds.add( "222222222222222" );
WebtrekkConfiguration webtrekkConfigurations = new WebtrekkConfiguration.Builder(trackIds, "https://your-trackdomain.com" )
.build();
Webtrekk.getInstance().init( this , webtrekkConfigurations);
}
}
Please ensure that you imported all required libraries:
import webtrekk.android.sdk.Webtrekk;
import webtrekk.android.sdk.WebtrekkConfiguration;