Track IDs and track domains are essential to track user behavior with the Intelligence SDK on a mobile application and must be added during configuration. Sometimes, it can be necessary to change the already configured settings on runtime, for example when offering to use the mobile application in various languages and analyzing each language in a separate account.

This can now easily be achieved by calling the respective method of the Android SDK. The method is available as of version 5.0.4 of the Android SDK.

Please note that changing the accounts on runtime will affect the entry and exit pages in the analyses and may increase the number of bounces. Please consult with your customer success manager before using this feature.

Methods / Classes

MethodDescription
abstract fun setIdsAndDomain(
trackIds: List<String>,
trackDomain: String
)
The function changes the globally configured track domain and track ID for the current session. If you want to ensure that the configuration is used for further sessions as well, you need to save the changes in the configuration builder class.
WebtrekkConfiguration.Builder(
private val trackIds: List<String>,
private val trackDomain: String
)
The class used to save the global configuration of the SDK, including the track ID and track domain used for the account.

Examples

  1. Call the function on the action, for example when opening a new screen:

    startNewScreen.setOnClickListener {
         val intent = Intent( this , NewScreen:: class .java)
         Webtrekk.getInstance().setIdsAndDomain(
             listOf( "111111111111111" ),
             "yourtrackdomain.mapp.com"
         )
         startActivity(intent)
    }
    JAVA
  2. Setup with more than one track id

    startNewScreen.setOnClickListener {
         val intent = Intent( this , NewScreen:: class .java)
         Webtrekk.getInstance().setIdsAndDomain(
             listOf( "111111111111111" , "222222222222222" ),
             "yourtrackdomain.mapp.com"
         )
         startActivity(intent)
    }
    JAVA
  1. Call the function on the action, for example when opening a new screen:

    public void newScreenOpen(View view) {
             Intent intent = new Intent( this , newScreen. class );
             
             List<String> trackIds = new ArrayList<>();
             trackIds.add( "111111111111111" );
     
             Webtrekk.getInstance().setIdsAndDomain(trackIds, "yourtrackdomain.mapp.com" );
     
             startActivity(intent);
         }
    JAVA
  2. Setup with more than one track id

    public void newScreenOpen(View view) {
             Intent intent = new Intent( this , newScreen. class );
     
             Webtrekk.getInstance().setIdsAndDomain(
                 Arrays.asList(
                     "111111111111111" ,
                     "222222222222222"
                 ),
                 "yourtrackdomain.mapp.com"
             );
             startActivity(intent);
         }
    JAVA

Known Limitations

  • This function changes the tracking-id and domain only during the session. To keep the same setup when the application starts again, you need to pass the same data to the main configuration function.
    More information here: Initialization.
    An example of how this can be implemented can be found here.
  • It is possible that there will be a short delay when changing settings.
  • It is not recommended to use the function with the same track ID as already used (e.g. when using multiple Account IDs and you only want to change one of them)
  • Please do not use this function more than once in 5 seconds. Frequent use can cause unwanted SDK behavior.