- 32 Minutes to read
- Print
- DarkLight
Query Parameter Tracking
- 32 Minutes to read
- Print
- DarkLight
If you have experience using the Mapp Intelligence API and Data Models, then query-based parameter tracking might be the right choice for you. This method allows you to customize your tracking by creating your own parameters and query URLs. For more details about alternative methods, see the Object-Oriented Tracking section.
Pages
Page tracking is possible with both auto-tracking enabled and disabled. When auto-tracking is disabled, only screens specifically marked for tracking are monitored.
Parameter Constants
Parameter constants are only applicable to query-based tracking. The following are available for page tracking:
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
PAGE_CATEGORY | Groups pages into app areas (called “Content Groups” in Mapp). | Categories > Content Groups | Datatype Text: Navigation > Content groups > [Name of Content group] Datatype Figure: metric |
PAGE_PARAM | Enriches Analytics data with app-specific information. | Custom Parameters > Page Parameters | Datatype Text: Navigation > Page Parameters > [Name of Parameter] Datatype Figure: metric |
INTERNAL_SEARCH | Tracks an internal search | - | Marketing > Search Phrases > Internal Search Phrases |
Find more information here:
Methods for Page Tracking
Method | Description |
---|---|
trackPage( context: Context, ) | Used for page tracking when you want to specify the context. You can define a custom page name in |
trackCustomPage( pageName: String, ) | Used for page tracking without specifying the context. You can define a page name in |
Note: Calling
trackPage()
ortrackCustomPage()
creates a new content ID. If auto-tracking is enabled, using these methods may result in multiple content IDs for the same page, which may distort your analytics. Use @TrackPageDetail or disable auto-tracking with @StopTrack or globally in Global Configuration.
Example
Please note that custom parameters are optional in the request.
First, define your custom parameters (names/ keys) as extension properties of
Param
.
For example, if this parameter has a key in the server with the name "cg1" or "cp10", you can define it this way in your app:val NEW_CATEGORY inline get() = customParam(ParamType.PAGE_CATEGORY, 1 ) //this will equal cg1 val NEW_PAGEPARAM inline get() = customParam(ParamType.PAGE_PARAM, 10 ) //this will equal cp10
For consistency and code convention, check the corresponding name in the server.
Add the custom parameters to the
TrackingParams()
object, which is a map of the names of the custom parameters (keys) and their values (that are tracked).val pageParams = TrackingParams() pageParams.putAll( mapOf( Param.NEW_CATEGORY to "category value 1" , Param.NEW_PAGEPARAM to "parameter value 10" , Param.INTERNAL_SEARCH to "search phrase" ) )
Send your
TrackingParams()
object to Mapp Intelligence.// Use trackCustomPage() Webtrekk.getInstance().trackCustomPage( "page name" , pageParams) // Use trackPage() Webtrekk.getInstance().trackPage( this , "page name" , pageParams)
Full Code Example:
class AppActivity : AppCompatActivity() {
val NEW_CATEGORY
inline get() = customParam(ParamType.PAGE_CATEGORY, 1 )
val NEW_PAGEPARAM
inline get() = customParam(ParamType.PAGE_PARAM, 10 )
override fun onCreate(savedInstanceState: Bundle?) {
super .onCreate(savedInstanceState)
setContentView(R.layout.activity_details)
val trackingParams = TrackingParams()
trackingParams.putAll(
mapOf(
Param.NEW_CATEGORY to "category value 1" ,
Param.NEW_PAGEPARAM to "parameter value 10" ,
Param.INTERNAL_SEARCH to "search phrase"
)
)
// Use trackCustomPage()
Webtrekk.getInstance().trackCustomPage( "page name" , pageParams)
// Use trackPage()
Webtrekk.getInstance().trackPage( this , "page name" , pageParams)
}
}
First, define your custom parameters (names/ keys) as extension properties of
Param
.
For example, if this parameter has a key in the server with the name "cg1" or "cp10", you can define it this way in your app:private static final String NEW_CATEGORY = createCustomParam(ParamType.PAGE_CATEGORY, 1 ); //This will equal cg1 private static final String NEW_PAGEPARAM = createCustomParam(ParamType.PAGE_PARAM, 10 ); //This will equal cp10
For consistency and code convention, check out the corresponding name in the server.
Add the custom parameters to the
TrackingParams()
object, which is a map of the names of the custom parameters (keys) and their values (that are tracked).Map<String, String> pageParams = new LinkedHashMap<>(); pageParams.put(BACKGROUND_PARAM, "blue" ); pageParams.put(NEW_CATEGORY, "category value 1" ); pageParams.put(NEW_PAGEPARAM, "page param value 1" );
Send your
TrackingParams()
object to Mapp.// Use trackCustomPage() Webtrekk.getInstance().trackCustomPage( "page name" , pageParams) // Use trackPage() Webtrekk.getInstance().trackPage( this , "page name" , pageParams)
Full Code Example:
public class AppActivity extends AppCompatActivity {
private static final String NEW_CATEGORY = createCustomParam(ParamType.PAGE_CATEGORY, 1 ); //This will equal cg1
private static final String NEW_PAGEPARAM = createCustomParam(ParamType.PAGE_PARAM, 10 ); //This will equal cp10
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Map<String, String> pageParams = new LinkedHashMap<>();
pageParams.put(BACKGROUND_PARAM, "blue" );
pageParams.put(NEW_CATEGORY, "category value 1" );
pageParams.put(NEW_PAGEPARAM, "page param value 1" );
//Use trackCustomPage
Webtrekk.getInstance().trackCustomPage( "custom page name" , pageParams);
//Use trackPage()
Webtrekk.getInstance().trackPage( this , "custome page name" , pageParams);
}
}
Custom Page Parameters
The following custom page parameters are predefined and are only used for page tracking:
PAGE_PARAM("cp")
PAGE_CATEGORY("cg")
The following custom parameters can be used for both page and event tracking:
CAMPAIGN_PARAM("cc")
SESSION_PARAM("cs")
URM_CATEGORY("uc")
ECOMMERCE_PARAM("cb")
PRODUCT_CATEGORY("ca")
You will also find detailed information about page parameters in our Pixel References: Page Parameters.
Events
Event or action tracking is available with both auto-tracking enabled and disabled. You can track custom events using trackCustomEvent()
, which is independent of activity/fragment context.
You will find tracked events under Navigation > Events.
Parameter Constants
Parameter constants only work for query-based tracking.
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to Analyze |
---|---|---|---|
EVENT_PARAM | Adds additional parameters to an event to further describe an Event | Categories > Custom Parameters > Event Parameter | Datatype Text: Navigation > Event Parameter > [Name of parameter] Datatype Figure: metric |
If you use the custom event parameter listed above for page tracking, their values will be ignored in Analytics.
Find more information here:
Methods
Method | Description |
---|---|
trackCustomEvent( eventName: String, ) | Used to track events in Intelligence when query parameter tracking is used. This option requires good knowledge of the Mapp Intelligence data model. An event name must always be given, and tracking parameters are optional. |
Example
Please note that custom parameters are optional in the request.
First, define your custom parameters (names/ keys) as extension properties of
Param
.
For example, if this parameter has a key in the server with the name "ck1", you can define it this way in your app:val Param.NEW_EVENTPARAM inline get() = customParam(ParamType.EVENT_PARAM, 1 ) // This will be equal to "ck1"
For consistency and code convention, check out the corresponding name in the server.
Add the custom parameters to the
TrackingParams
object, which is a map of the names of the custom parameters (keys) and their values (that are tracked).val eventParams = TrackingParams() eventParams.putAll( mapOf( Param.NEW_EVENTPARAM to "event parameter value 1" ) )
Send the mapping object to Intelligence:
Webtrekk.getInstance().trackCustomEvent(eventName = "your event name" , trackingParams = eventParams)
Full code example
class AppActivity : AppCompatActivity() {
val Param.NEW_EVENTPARAM
inline get() = customParam(ParamType.EVENT_PARAM, 1 )
val eventParams = TrackingParams()
override fun onCreate(savedInstanceState: Bundle?) {
super .onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
eventParams.putAll(
mapOf(
Param.NEW_EVENTPARAM to "event parameter value 1"
)
)
startNewActivity.setOnClickListener {
val intent = Intent( this , NewActivity:: class .java)
//With custom event parameters
Webtrekk.getInstance().trackCustomEvent(eventName = "your event name" , trackingParams = eventParams)
//Without custom event parameters
Webtrekk.getInstance().trackCustomEvent(eventName = "your event name" )
startActivity(intent)
}
}
}
First, define your custom parameters (names/keys) as extension properties of
Param
.
For example, if this parameter has a key in the server with the name "ck1", you can define it this way in your app:private static final String NEW_EVENTPARAM = createCustomParam(ParamType.EVENT_PARAM, 1 ); //This will be equal to ck1
For consistency and code convention, check out the corresponding name in the server
Build a map and assign your parameters (names/keys) to the values:
Map<String, String> eventParams = new LinkedHashMap<>(); eventParams.put(NEW_EVENTPARAM, "event parameter value 1" )
Send the mapping object to Intelligence:
Webtrekk.getInstance().trackCustomEvent( "your event name" ,eventParams);
Full code example
public class MainActivity extends AppCompatActivity {
private static final String NEW_EVENTPARAM = createCustomParam(ParamType.EVENT_PARAM, 1 ); //This will equal ck1
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
public void goToNewActivity(){
Intent intent = new Intent( this , NewActivity. class );
Map<String, String> eventParams = new LinkedHashMap<>();
eventParams.put(NEW_EVENTPARAM, "event parameter value 1" );
//With custom event parameters
Webtrekk.getInstance().trackCustomEvent( "your event name" , eventParams);
//Without custom event parameters
Webtrekk.getInstance().trackCustomEvent( "your event name" , Collections.emptyMap());
startActivity(intent);
}
}
Custom Event Parameters
The custom event parameter can only be used for event tracking:
EVENT_PARAM("ck")
The following custom parameters can be used for both page and event tracking:
CAMPAIGN_PARAM("cc")
SESSION_PARAM("cs")
URM_CATEGORY("uc")
ECOMMERCE_PARAM("cb")
PRODUCT_CATEGORY("ca")
You can also find detailed information about event parameters in our Pixel References: Event Parameters.
Products and Orders
You can analyze detailed product interactions in your app. This includes tracking when products are viewed, added to the cart, and purchased. You can also analyze abandoned shopping carts and track the completion of orders with comprehensive information.
Key Information for Product and Order Tracking:
You can add detailed information to products and orders using e-commerce parameters. Parameter constants only work for query-based tracking.
The status of a product must be set correctly to ensure that all tracking works as expected for Mapp Intelligence e-commerce use cases.
Parameter Constants
Parameter constants only work for query-based tracking. Predefined eCommerce parameters are defined in the ECommerceParam class, and custom parameters can be created using the ParamType class.
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
ECOMMERCE_PARAM | Used to add information about products/orders. | Custom Parameters > E-Commerce Parameter | Datatype Text: E-Commerce > [] Datatype Figure: metric |
PRODUCT_CATEGORY | Predefined parameter. Used to group products. Product categories allow the grouping of products. The relationship between product and product category must be unique. | Categories > Product Categories | |
PRODUCT_NAME | Predefined parameter. Name of the product to be tracked. Multiple products need to be separated by a semicolon. A product name cannot exceed 110 characters. | - | |
PRODUCT_COST | Predefined parameter. Contains the product price ("0" values are allowed). If you transmit a product several times (quantity parameter PRODUCT_QUANTITY greater than 1), use the total price, not the unit price. If several prices are transmitted, they are each separated by a semicolon. | - | |
PRODUCT_CURRENCY | Predefined parameter. Contains the currency code of a product or order; the value must be passed to Intelligence in line with the ISO standard. If multiple products are transmitted on a single screen (e.g., on the order confirmation page if more than one product was purchased), only one currency will be applied to all products. This means that the value only needs to be set once. Note: The currency is only passed for currency conversion. In other words, it will be converted to the one (if any) stored in Mapp Q3 ( Configuration > System Configuration> Data Collection). Only one currency is ever displayed here. | - | |
PRODUCT_QUANTITY | Predefined parameter. Contains the product quantity. If several products are transmitted, they are each separated by a semicolon. | - | |
STATUS_OF_SHOPPING_CARD | Predefined parameter. Contains the shopping cart status. There are three possible values for the parameter:
| - | |
ORDER_ID | Predefined parameter. Contains a unique order number (order ID). The use of this setting ensures that no orders are counted twice. | - | |
ORDER_VALUE | Predefined parameter. Contains the total order value. | - | |
CANCELLATION_VALUE | Predefined parameter | - | |
PRODUCT_SOLD_OUT | Predefined parameter. Possible values:
| - | |
RETURNING_OR_NEW_CUSTOMER | Predefined parameter. Figure. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
RETURN_VALUE | Predefined parameter. Figure. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
COUPON_VALUE | Predefined parameter. Figure. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
PRODUCT_ADVERTISE_ID | Predefined parameter. Figure. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
PAYMENT_METHOD | Predefined parameter. String. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
SHIPPING_SERVICE_PROVIDER | Predefined parameter. String. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
SHIPPING_SPEED | Predefined parameter. String. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
SHIPPING_COST | Predefined parameter. Figure. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
MARK_UP | Predefined parameter. Figure. | Custom Parameters > E-Commerce Parameter > Preconfigured | |
ORDER_STATUS | Predefined parameter. String. | Custom Parameters > E-Commerce Parameter > Preconfigured |
Example
Define the parameters in your app:
val NEW_PRODUCT_CATEGORY inline get() = customParam(ParamType.PRODUCT_CATEGORY, 1) val NEW_ECOMMERCE_PARAM inline get() = customParam(ParamType.ECOMMERCE_PARAM, 1) val PRODUCT_SOLD_OUT inline get() = customParam(ParamType.ECOMMERCE_PARAM, 760) // Tracks if a product is sold out. Value must be 760 to use the correct pre-defined parameter
private static final String NEW_PRODUCT_CATEGORY = createCustomParam(ParamType.PRODUCT_CATEGORY, 1); private static final String NEW_ECOMMERCE_PARAM = createCustomParam(ParamType.ECOMMERCE_PARAM, 1); private static final String PRODUCT_SOLD_OUT = createCustomParam(ParamType.ECOMMERCE_PARAM, 760); // Tracks if a product is sold out. Value must be 760 to use the correct pre-defined parameter
Track the desired products as viewed in your app:
val productParams: MutableMap<String, String> = LinkedHashMap() productParams[PRODUCT_NAME] = "productId" productParams[STATUS_OF_SHOPPING_CARD] = "view" productParams[PRODUCT_COST] = "product cost" productParams[PRODUCT_CURRENCY] = "gbp" productParams[NEW_PRODUCT_CATEGORY] = "category productID" productParams[NEW_ECOMMERCE_PARAM] = "ecommerce param productID" productParams[PRODUCT_QUANTITY] = "quantity of product" productParams[PRODUCT_SOLD_OUT] = "1" //1 = product sold out, 0 = product available Webtrekk.getInstance().trackCustomPage("page name", productParams)
Map<String, String> productParams = new LinkedHashMap<>(); productParams.put(PRODUCT_NAME, "productId"); productParams.put(STATUS_OF_SHOPPING_CARD, "view"); productParams.put(PRODUCT_COST, "product cost"); productParams.put(Param.PRODUCT_CURRENCY, "gbp"); productParams.put(NEW_PRODUCT_CATEGORY, "category productID"); productParams.put(NEW_ECOMMERCE_PARAM, "ecommerce param productID"); productParams.put(PRODUCT_QUANTITY, "quantity of product"); productParams.put(PRODUCT_SOLD_OUT, "1"); //1 = product sold out, 0 = product available Webtrekk.getInstance().trackCustomPage("page name", productParams);
Track add to cart status by changing STATUS_OF_SHOPPING_CARD to "add":
val productParams: MutableMap<String, String> = LinkedHashMap() productParams[PRODUCT_NAME] = "productId" productParams[STATUS_OF_SHOPPING_CARD] = "add" productParams[PRODUCT_COST] = "product cost" productParams[PRODUCT_CURRENCY] = "gbp" productParams[NEW_PRODUCT_CATEGORY] = "category productID" productParams[NEW_ECOMMERCE_PARAM] = "ecommerce param productID" productParams[PRODUCT_QUANTITY] = "quantity of product" Webtrekk.getInstance().trackCustomPage("page name", productParams)
Map<String, String> productParams = new LinkedHashMap<>(); productParams.put(PRODUCT_NAME, "productID"); productParams.put(STATUS_OF_SHOPPING_CARD, "add"); productParams.put(PRODUCT_COST, "product cost"); productParams.put(Param.PRODUCT_CURRENCY, "gbp"); productParams.put(NEW_PRODUCT_CATEGORY, "category productID"); productParams.put(NEW_ECOMMERCE_PARAM, "ecommerce param productID"); productParams.put(PRODUCT_QUANTITY, "quantity of product"); Webtrekk.getInstance().trackCustomPage("page name", productParams);
Track order confirmation by changing STATUS_OF_SHOPPING_CARD to "conf" and add order information:
val productParams: MutableMap<String, String> = LinkedHashMap() productParams[PRODUCT_NAME] = "productId1;productId2;productIdN" productParams[STATUS_OF_SHOPPING_CARD] = "conf" productParams[PRODUCT_COST] = "cost productID1; cost productId2; cost productIdN" productParams[PRODUCT_CURRENCY] = "gbp" productParams[NEW_PRODUCT_CATEGORY] = "category productId1;;category productIdN" productParams[NEW_ECOMMERCE_PARAM] = "ecommerce param productId1;ecommerce productId2;" productParams[PRODUCT_QUANTITY] = "number productId1;number productId2;number productIdN" productParams[PRODUCT_SOLD_OUT] = "1" //1 = product sold out, 0 = product available productParams[ORDER_ID] = "order ID" productParams[ORDER_VALUE] = "total order value" Webtrekk.getInstance().trackCustomPage("order conf pagename", productParams)
Map<String, String> productParams = new LinkedHashMap<>(); productParams.put(PRODUCT_NAME, "productId1;productId2;productIdN"); productParams.put(STATUS_OF_SHOPPING_CARD, "conf"); productParams.put(PRODUCT_COST, "cost productId1; cost productId2; cost productIdN"); productParams.put(Param.PRODUCT_CURRENCY, "gbp"); productParams.put(NEW_PRODUCT_CATEGORY, "category productId1;;category productIdN"); productParams.put(NEW_ECOMMERCE_PARAM, "ecommerce param productId1;ecommerce productId2;"); productParams.put(PRODUCT_QUANTITY, "number productId1;number productId2;number productIdN"); productParams.put(ORDER_ID, "your order ID"); productParams.put(ORDER_VALUE, "total order value"); Webtrekk.getInstance().trackCustomPage("order conf page name", productParams);
Please note that when adding multiple products to one order, you need to separate the values for each product via a semicolon (;) in the correct order to correctly analyze it in Intelligence.
Goals
You can track goal achievements using page or event requests in Mapp Intelligence, allowing you to evaluate which campaigns led to conversions. Learn more about how to define goals in Mapp Q3 here.
Further information about the analysis and use of website goals in Mapp Intelligence can be found in the training chapter Analysis of Goal Achievement.
Parameter Constants
Parameter constants only work for query-based tracking.
Parameter | Description | Where to Configure (Mapp Q3 > Configuration > ...) | Where to Analyze |
---|---|---|---|
ECOMMERCE_PARAM | Ensure the e-commerce parameter is configured as a website goal in Mapp Q3! | Goal > New Goal (Please ensure you created the respective e-commerce parameter before) | Marketing > Website Goals |
Example
First, define your e-commerce parameters (names/ keys) as extension properties of
Param
. Ensure the parameters are configured as a website goal in your Mapp Q3 account!
For example, if this parameter has id "1", you can define it this way in your app:val Param.NEW_GOAL inline get() = customParam(ParamType.ECOMMERCE_PARAM, 1 ) //this will equal cb1
For consistency and code convention, check out the corresponding name in the server.
Add the custom parameters to the
TrackingParams()
object, which is a map of the names of the custom parameters (keys) and their values (that are tracked).val trackingParams = TrackingParams() trackingParams.putAll( mapOf( Param.NEW_GOAL to "goal value 1" ) )
Send your
TrackingParams()
object to Mapp.// Track as page without context Webtrekk.getInstance().trackCustomPage( "page name" , trackingParams) // Track as page with context Webtrekk.getInstance().trackPage( this , "page name" , trackingParams) //Track as event Webtrekk.getInstance().trackCustomEvent(eventName = "your event name" , trackingParams = trackingParams)
Full Code Example
class AppActivity : AppCompatActivity() {
val Param.NEW_GOAL
inline get() = customParam(ParamType.ECOMMERCE_PARAM, 1 )
override fun onCreate(savedInstanceState: Bundle?) {
super .onCreate(savedInstanceState)
setContentView(R.layout.activity_details)
val trackingParams = TrackingParams()
trackingParams.putAll(
mapOf(
Param.NEW_GOAL to "goal value 1"
)
)
// Track as page without context
Webtrekk.getInstance().trackCustomPage( "page name" , trackingParams)
// Track as page with context
Webtrekk.getInstance().trackPage( this , "page name" , trackingParams)
//Track as event
startNewActivity.setOnClickListener {
val intent = Intent( this , NewActivity:: class .java)
Webtrekk.getInstance().trackCustomEvent(eventName = "your event name" , trackingParams = trackingParams)
startActivity(intent)
}
}
}
First, define your custom parameters (names/ keys) as extension properties of
Param
. Make sure that the parameters are configured as a website goal in your Mapp Q3 account!private static final String NEW_GOAL = createCustomParam(ParamType.ECOMMERCE_PARAM, 1 , 1 ); //This will equal cb1
For consistency and code convention, check out the corresponding name in the server.
Add the custom parameters to the
TrackingParams()
object, which is a map of the names of the custom parameters (keys) and their values (that are tracked).Map<String, String> trackingParams = new LinkedHashMap<>(); trackingParams.put(NEW_GOAL, "goal value 1" );
Send your
TrackingParams()
object to Intelligence.// Track as page request without context Webtrekk.getInstance().trackCustomPage( "page name" , trackingParams) // Track as page with context Webtrekk.getInstance().trackPage( this , "page name" , trackingParams) // Track as event Webtrekk.getInstance().trackCustomEvent( "your event name" , trackingParams)
Full Code Example
public class AppActivity extends AppCompatActivity {
private static final String NEW_GOAL = createCustomParam(ParamType.ECOMMERCE_PARAM, 1 ); //This will equal cb1
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Map<String, String> trackingParams = new LinkedHashMap<>();
trackingParams.put(NEW_GOAL, "goal value 1" );
//Track as page without context
Webtrekk.getInstance().trackCustomPage( "custom page name" , trackingParams);
//Track as page with context
Webtrekk.getInstance().trackPage( this , "custome page name" , trackingParams);
//Track as event step1
Button button = findViewById(R.id.button);
button.setOnClickListener ( new View.OnClickListener(){
@Override
public void onClick(View v){
goToNextActivity();
}
});
//Track as event step2
public void goToNextActivity(){
Intent intent = new Intent( this , NextActivity. class );
Map<String, String> trackingParams = new LinkedHashMap<>();
trackingParams.put(NEW_GOAL, "goal value 1" );
Webtrekk.getInstance().trackCustomEvent( "your event name" , trackingParams);
startActivity(intent);
}
}
}
If you get errors, be sure to check that you imported the necessary libraries:
import webtrekk.android.sdk.ParamType;
import webtrekk.android.sdk.Webtrekk;
import static webtrekk.android.sdk.ParamTypeKt.createCustomParam;
Campaigns
Campaign tracking allows you to track the effectiveness of marketing campaigns. This is configured in Mapp Q3 (Configuration > Marketing Configuration).
Further information about campaigns can be found in the training chapter Campaign Configuration.
Campaigns can be tracked in both page and event requests.
Parameter Constants
Parameter constants only work for query-based tracking. Predefined campaign parameters are defined in the CampaignParam class, and custom parameters can be created using the ParamType class.
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
MEDIA_CODE | The media code is used to mark campaigns in Intelligence. | - | Marketing > Campaigns |
CAMPAIGN_PARAM | Used to enrich campaigns with additional parameters. | Configuration > Custom Parameters > Campaign Parameter | Datatype Text: Marketing > Campaign Parameters Datatype Figure: metric |
For deep link campaigns, please check the dedicated use case description.
Sessions
You can enrich sessions with additional parameters. Depending on the settings in your account, the first or last value of the parameter will be used for analyses.
Session parameters can be tracked in both page and event requests.
Parameter Constants
Parameter constants are only available for query-based tracking.
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
SESSION_PARAM | Used to enrich analyses of sessions with additional information. | Custom Parameters > Session Parameter | Datatype Text: Visitors > Session Parameters Datatype Figure: metric |
Predefined Session Parameter
Some session parameters can be preconfigured, including App version, App updated, and App first open. These parameters can be activated without needing to be defined in your mobile app, simplifying session tracking.
The following parameters are predefined in the SDK:
Parameter | Parameter ID | Description | Data Type | Calculation |
---|---|---|---|---|
App updated | 815 | Tracks when the app is updated to a new version. | Figure | The last value wins (tracked once per session). |
App version | 804 | Tracks which app version users are using. | Text | The last value wins (tracked once per session). |
App first open | 821 | Tracks the first time the app is opened after being installed from a store or the web. | Text | The first value wins (tracked once per session). |
To configure the session parameter, proceed as follows:
Log in to your Mapp Q3 account.
Go to Configuration > Custom Parameters > Session parameters
Then click Create a new custom parameter. The specification dialog for the session parameter opens.
Make the following configuration:
Parameter
Description
Title
Mandatory. Enter the name of the session parameter.
Description
Optional. Enter a description for the session parameter.
Active
Select via the radio button whether the session parameter is active or inactive. When disabled, no data is collected.
Preconfigured
Under "Preconfigured," select one of the following parameters:
App updated
App version
App first open
Preset settings apply automatically.
Parameter ID
The ID is set automatically by the system.
Click Save to save your settings.
Users
User tracking allows you to categorize users to improve analyses in Mapp Intelligence. You can transmit both pre-defined and custom categories for each user.
User data can be tracked in both page and event requests.
Recommendation
Transmit hashed personal data should not be evaluated in terms of content (e.g. with the SHA256 hash). If you would like to collect this data for analytical reasons, we suggest that you transmit the data in encrypted form (see How to Implement Server-Side Encryption in Mapp Intelligence).
Parameter Constants
Parameter constants are only available for query-based tracking. Predefined customer parameters are defined in the UserCategoriesParam class, and custom parameters can be created using the ParamType class.
Parameter | Description |
URM_CATEGORY | Used to specify custom user information to enrich customer information with additional data. Needs to be configured under Mapp Q3 > Configuration > Categories > User Categories |
CUSTOMER_ID | Predefined URM category. Used to uniquely identify a user. We highly recommend using MD5 or SHA methods if you pass email addresses. |
FIRST_NAME | Predefined User category |
LAST_NAME | |
CITY | |
COUNTRY | |
STREET | |
STREET_NUMBER | |
ZIP_CODE | |
GENDER | Predefined User category. Possible values:
|
BIRTHDAY | Predefined User category |
EMAIL_ADDRESS | |
PHONE_NUMBER | |
EMAIL_RECEIVER_ID | |
NEW_SELLER_SUBSCRIBED |
Forms
Form tracking is available in native Android applications from SDK version 5.0.1.
This feature allows customers to capture detailed user input on forms, tracking whether each form field is filled out or left empty.
Trackable Field Types
You can track user input for the following field types:
EditText
Plain
Multiline
AutoComplete
MultiAutoComplete
Email
Address
Phone
Password
Number
Time
Date
SearchView
RadioButton
ToggleButton
Switch
CheckBox
RatingBar
Spinner
Methods and Properties
Name of Function
formTracking(
context: Context,
view: View? = null,
formTrackingSettings: FormTrackingSettings = FormTrackingSettings()
)
Attribute | Description | Mandatory |
---|---|---|
context | The context of the current activity. | yes |
view | Overrides the local view used in the activity. | no |
formTrackingSettings | Additional settings to customize form tracking | no |
Configuration
formName: Specify a name for the form (default: activity/view name).
fieldIds: Specify field IDs to track only certain fields (default: all fields are tracked)
renameFields: Change the default field name (default: the name of the field ID)
changeFieldsValue: Override the default field value (if hardcoded, the field always reflects this value).
anonymousSpecificFields: Anonymize specific fields (default: only EditText fields are anonymized).
fullContentSpecificFields: Send the actual content of specified fields (default: EditText fields are anonymized).
confirmButton: Marks form submission(submitted or canceled) (default: true).
anonymous: Anonymizes all field types if set to true.
pathAnalysis: You can track the order in which the user has filled out the fields. Please note that you need to track the order manually and parse the data using the fieldsOrder function. Mapp Intelligence cannot track the order in which the user fills out the form automatically.
data class FormTrackingSettings(
var formName: String = "",
var fieldIds: List<Int> = emptyList(),
var renameFields: Map<Int, String> = emptyMap(),
var changeFieldsValue: Map<Int, String> = emptyMap(),
var anonymousSpecificFields: List<Int> = emptyList(),
var fullContentSpecificFields: List<Int> = emptyList(),
var confirmButton: Boolean = true,
var anonymous: Boolean = true,
var pathAnalysis: List<Int> = emptyList()
)
Example
// set form tracking config for confirmation and cancellation of form
class FormActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.form_main)
//Set a listener on the cancel button of a form
cancel.setOnClickListener {
val form = FormTrackingSettings()
form.confirmButton = false //confirm button is
form.formName = "test123"
form.anonymous = true
form.anonymousSpecificFields = listOf(R.id.editText, R.id.editText3, R.id.switch1)
form.fullContentSpecificFields = listOf(R.id.editText2)
Webtrekk.getInstance().formTracking(this, formTrackingSettings = form)
}
//Set a listener on the confirm button of a form
confirm.setOnClickListener {
val form = FormTrackingSettings()
form.confirmButton = true
form.formName = "test123"
form.anonymous = true
form.anonymousSpecificFields = listOf(R.id.editText2)
form.fullContentSpecificFields = listOf(R.id.editText, R.id.editText3, R.id.switch1)
Webtrekk.getInstance().formTracking(this, formTrackingSettings = form)
}
}
}
// configure specific view
val view =
findViewById<View>(android.R.id.content).rootView
Webtrekk.getInstance().formTracking(this,view=view)
// configure form name
val form= FormTrackingSettings()
form.formName="My Form"
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// congfigure to track only specific fields
val form= FormTrackingSettings()
form.fieldsOrder= listOf(R.id.editText2,R.id.editText)
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// rename fields
val form= FormTrackingSettings()
form.renameFields=mapOf(Pair(R.id.editText2,"Named text view"))
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// anonymise specific fields
val form= FormTrackingSettings()
form.anonymousSpecificFields=listOf(R.id.switch1)
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// anonymise all fields
val form= FormTrackingSettings()
form.anonymous=true
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// show full content of specific fields
val form= FormTrackingSettings()
form.fullContentSpecificFields=listOf(R.id.editText1)
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// change value of fields
val form= FormTrackingSettings()
form.changeFieldsValue=mapOf(Pair(R.id.editText2,"New value")) // this needs to be filled dynamically!
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// set confirm button to false
val form= FormTrackingSettings()
form.confirmButton=false
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// track path analysis
val form= FormTrackingSettings()
form.pathAnalysis= listOf(R.id.editText2,R.id.editText,R.id.editText3) //this needs to be filled dynamically!
Webtrekk.getInstance().formTracking(this,formTrackingSettings=form)
// set form tracking config for confirmation and cancellation of form
public class FormActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private Button cancel;
private Button confirm;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.form_main);
//Set a listener on the cancel button of a field
cancel = findViewById(R.id.cancel);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FormTrackingSettings form = new FormTrackingSettings();
form.setConfirmButton(false);
form.setFormName("test123");
form.setAnonymous(true);
form.setAnonymousSpecificFields(Arrays.asList(R.id.editText, R.id.editText3, R.id.switch1));
form.setFullContentSpecificFields(Arrays.asList(R.id.editText2));
Webtrekk.getInstance().formTracking(FormActivity.this, null, form);
}
});
//Set a listener to the confirm button of a field
confirm = findViewById(R.id.confirm);
confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FormTrackingSettings form = new FormTrackingSettings();
form.setConfirmButton(true);
form.setFormName("test123");
form.setAnonymous(false);
form.setAnonymousSpecificFields(Arrays.asList(R.id.editText2));
form.setFullContentSpecificFields(Arrays.asList(R.id.editText, R.id.editText3, R.id.switch1));
Webtrekk.getInstance().formTracking(FormActivity.this, null, form);
}
});
}
}
// Configure specific view
View view = findViewById(android.R.id.content).getRootView();
Webtrekk.getInstance().formTracking(this, view, new FormTrackingSettings());
// Configure form name
FormTrackingSettings form = new FormTrackingSettings();
form.setFormName("My Form");
Webtrekk.getInstance().formTracking(this, null, formOne);
// Configure to track only specific fields
FormTrackingSettings form = new FormTrackingSettings();
form.setFieldIds(Arrays.asList(R.id.editText2, R.id.editText));
Webtrekk.getInstance().formTracking(this, null, formTwo);
// Rename fields
FormTrackingSettings form = new FormTrackingSettings();
form.setRenameFields(new LinkedHashMap<Integer, String>() {{
put(R.id.editText2, "Named text view");
}});
Webtrekk.getInstance().formTracking(this, null, formThree);
// Anonymize specific fields
FormTrackingSettings form = new FormTrackingSettings();
form.setAnonymousSpecificFields(Arrays.asList(R.id.switch1));
Webtrekk.getInstance().formTracking(this, null, formFour);
// Anonymize all fields
FormTrackingSettings form = new FormTrackingSettings();
form.setAnonymous(true);
Webtrekk.getInstance().formTracking(this, null, formFive);
// Show full content of specific fields
FormTrackingSettings form = new FormTrackingSettings();
form.setFullContentSpecificFields(Arrays.asList(R.id.editText));
Webtrekk.getInstance().formTracking(this, null, formSix);
// Change value of fields
FormTrackingSettings form = new FormTrackingSettings();
form.setChangeFieldsValue( new LinkedHashMap<Integer, String>() {{
put(R.id.editText2, "New Value");
}}); // this needs to be filled dynamically!
Webtrekk.getInstance().formTracking(this, null, formSeven);
// Set confirm button to false
FormTrackingSettings form = new FormTrackingSettings();
form.setConfirmButton(false);
Webtrekk.getInstance().formTracking(this, null, formEight);
// Track path analysis
FormTrackingSettings form = new FormTrackingSettings();
form.setPathAnalysis(Arrays.asList(R.id.editText2,R.id.editText,R.id.editText3)); //this needs to be filled dynamically!
Webtrekk.getInstance().formTracking(this, null, formNine);
Additional Resources
Please also check our sample application inside our Android SDK v5 version to try out form tracking in a sample app. You can download the SDK from GitHub.
Known Limitations
Last Focus does not work faultlessly and only for editText types.
pathAnalysis and rename fields do not work automatically.
Media Tracking
The Media Tracking API allows you to track user interactions with media files, such as videos or audio, in your app. You can track events such as media play, pause, seek actions, and more. Media tracking provides insights into how users engage with your media content, including metrics like duration watched, position within the media, and interaction frequency.
You will find tracked media under Navigation > Media > Media.
Parameter Constants
Parameter constants can only be used in query-based tracking.
Parameter | Description | Mandatory | Where to Analyze |
---|---|---|---|
MEDIA_CATEGORY = "mg" | Media Categories. Needs to be configured under Mapp Q3 > Configuration > Categories > User Categories | no | Datatype Text: Navigation > Media Categories Datatype Figure: metric |
MEDIA_NAME = "mi" | Video Name | yes | Navigation > Media > Media |
MEDIA_ACTION = "mk" | The current action of the Media Player. Possible values are:
| yes | Navigation > Media > Media Player Actions |
MEDIA_POSITION = "mt1" | The current position of the media in seconds (required) | yes | Navigation > Media > Media Run Time |
MEDIA_DURATION = "mt2" | Total play duration of the media in seconds (required) | yes | - |
BANDWIDTH = "bw" | Bandwidth bits/seconds | no | Navigation > Media > Media Bandwidth |
VOLUME = "vol" | Volume, number 0-255, 0 is minimal, 255 is maximal | no | Navigation > Media > Media Player Volume |
MUTE = "mut" | (1=mute active, volume off, 0=mute not active, volume on) | no | Navigation > Media > Media Player Mute |
Methods
Method | Description |
---|---|
| A media name is required and should be unique for each video. Tracking params contains all parameters, media, or custom. |
Example
// Step: Track media initialization (init action)
val trackingParams = mutableMapOf(
MediaParam.MEDIA_DURATION to "300",
MediaParam.MEDIA_POSITION to "0",
MediaParam.MEDIA_ACTION to "init"
)
Webtrekk.getInstance().trackMedia("football123", trackingParams)
// Step: Track media play
trackingParams[MediaParam.MEDIA_ACTION] = "play"
trackingParams[MediaParam.MEDIA_POSITION] = "30"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
// Step: Track media seek
trackingParams[MediaParam.MEDIA_ACTION] = "seek"
trackingParams[MediaParam.MEDIA_POSITION] = "60"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
Full Code Example
constructor(context: Context?) : super (context) {
initMediaFile()
}
fun initMediaFile() {
trackingParams.putAll(
mapOf(
MediaParam.MEDIA_DURATION to duration.toString(),
MediaParam.MEDIA_POSITION to (currentPosition / 1000 ).toString(),
MediaParam.MEDIA_ACTION to "init"
)
)
Webtrekk.getInstance().trackMedia( "video name" , trackingParams)
}
override fun pause() {
super .pause()
trackingParams.putAll(
mapOf(
MediaParam.MEDIA_POSITION to (currentPosition / 1000 ).toString(),
MediaParam.MEDIA_ACTION to "pause"
)
)
Webtrekk.getInstance().trackMedia( "video name" , trackingParams)
}
override fun start() {
super .start()
trackingParams.putAll(
mapOf(
MediaParam.MEDIA_POSITION to (currentPosition / 1000 ).toString(),
MediaParam.MEDIA_ACTION to "play"
)
)
Webtrekk.getInstance().trackMedia( "video name" , trackingParams)
}
override fun stopPlayback() {
super .stopPlayback()
trackingParams.putAll(
mapOf(
MediaParam.MEDIA_POSITION to (currentPosition / 1000 ).toString(),
MediaParam.MEDIA_ACTION to "stop"
)
)
Webtrekk.getInstance().trackMedia( "video name" , trackingParams)
}
override fun seekTo(msec: Int) {
trackingParams.putAll(
mapOf(
MediaParam.MEDIA_POSITION to (currentPosition / 1000 ).toString(),
MediaParam.MEDIA_ACTION to "seek"
)
)
Webtrekk.getInstance().trackMedia( "video name" , trackingParams)
super .seekTo(msec)
trackingParams.putAll(
mapOf(
MediaParam.MEDIA_POSITION to (currentPosition / 1000 ).toString(),
MediaParam.MEDIA_ACTION to "pause" // can be pause or play
)
)
Webtrekk.getInstance().trackMedia( "video name" , trackingParams)
}
Map<String, String> trackingParams = new HashMap<>();
// Step 1: Track media initialization
trackingParams.put(MediaParam.MEDIA_DURATION, String.valueOf(duration / 1000));
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000));
trackingParams.put(MediaParam.MEDIA_ACTION, "init");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
// Step 2: Track media stop
trackingParams.put(MediaParam.MEDIA_DURATION, String.valueOf(duration / 1000));
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000));
trackingParams.put(MediaParam.MEDIA_ACTION, "stop");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
// Step 3: Track media seek
trackingParams.put(MediaParam.MEDIA_DURATION, String.valueOf(duration / 1000));
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000));
trackingParams.put(MediaParam.MEDIA_ACTION, "seek");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
Full Code Example
public TrackedVideoView( @Nullable Context context) {
super (context);
this .initMediaFile();
}
public void initMediaFile() {
Map<String, String> trackingParams = new HashMap<>();
trackingParams.put(MediaParam.MEDIA_DURATION, String.valueOf(duration / 1000 ));
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000 ));
trackingParams.put(MediaParam.MEDIA_ACTION, "init" );
Webtrekk.getInstance().trackMedia( "video name" , trackingParams);
}
@Override
public void pause() {
super .pause()
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000 ));
trackingParams.put(MediaParam.MEDIA_ACTION, "pause" );
Webtrekk.getInstance().trackMedia( "video name" , trackingParams);
}
@Override
public void start() {
super .start()
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000 ));
trackingParams.put(MediaParam.MEDIA_ACTION, "play" );
Webtrekk.getInstance().trackMedia( "video name" , trackingParams);
}
@Override
public void stopPlayback() {
super .stopPlayback()
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000 ));
trackingParams.put(MediaParam.MEDIA_ACTION, "stop" );
Webtrekk.getInstance().trackMedia( "video name" , trackingParams);
}
@Override
public void seekTo(msec: Int) {
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000 ));
trackingParams.put(MediaParam.MEDIA_ACTION, "seek" );
Webtrekk.getInstance().trackMedia( "video name" , trackingParams);
super .seekTo(msec)
trackingParams.put(MediaParam.MEDIA_POSITION, String.valueOf(currentPosition / 1000 ));
trackingParams.put(MediaParam.MEDIA_ACTION, "pause" ); // can be pause or play
Webtrekk.getInstance().trackMedia( "video name" , trackingParams);
}
API Constraints: Start a media session
Start a Media Session: The session must start with an init or play action.
Seek Action: When seeking, the position at the start of the seek action should be sent, followed by either play or pause after seeking is complete.
Example 1: Media Seek with Continuous Play
A user is watching a video and seeks from 8 seconds to 20 seconds, continuing playback.
Kotlin:
// Start with play at position 8 seconds
trackingParams[MediaParam.MEDIA_ACTION] = "play"
trackingParams[MediaParam.MEDIA_POSITION] = "8"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
// Seek to 20 seconds
trackingParams[MediaParam.MEDIA_ACTION] = "seek"
trackingParams[MediaParam.MEDIA_POSITION] = "8"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
// Continue playing from 20 seconds
trackingParams[MediaParam.MEDIA_ACTION] = "play"
trackingParams[MediaParam.MEDIA_POSITION] = "20"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
Java:
// Start with play at position 8 seconds
trackingParams.put(MediaParam.MEDIA_ACTION, "play");
trackingParams.put(MediaParam.MEDIA_POSITION, "8");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
// Seek to 20 seconds
trackingParams.put(MediaParam.MEDIA_ACTION, "seek");
trackingParams.put(MediaParam.MEDIA_POSITION, "8");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
// Continue playing from 20 seconds
trackingParams.put(MediaParam.MEDIA_ACTION, "play");
trackingParams.put(MediaParam.MEDIA_POSITION, "20");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
Please note that Exo2Player changes a state to pause automatically after each seeks. You need to manually suppress that to be aligned with the API expectation.
Example 2: Media Seek with Pause
The user pauses the video at 8 seconds, seeks to 20 seconds, and the video remains paused.
Kotlin:
// Pause at 8 seconds
trackingParams[MediaParam.MEDIA_ACTION] = "pause"
trackingParams[MediaParam.MEDIA_POSITION] = "8"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
// Seek to 20 seconds
trackingParams[MediaParam.MEDIA_ACTION] = "seek"
trackingParams[MediaParam.MEDIA_POSITION] = "8"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
// Stay paused at 20 seconds
trackingParams[MediaParam.MEDIA_ACTION] = "pause"
trackingParams[MediaParam.MEDIA_POSITION] = "20"
Webtrekk.getInstance().trackMedia("football123", trackingParams)
Java:
// Pause at 8 seconds
trackingParams.put(MediaParam.MEDIA_ACTION, "pause");
trackingParams.put(MediaParam.MEDIA_POSITION, "8");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
// Seek to 20 seconds
trackingParams.put(MediaParam.MEDIA_ACTION, "seek");
trackingParams.put(MediaParam.MEDIA_POSITION, "8");
Webtrekk.getInstance().trackMedia("football123", trackingParams);
// Stay paused at 20 seconds
trackingParams.put(MediaParam.MEDIA_ACTION, "pause");
trackingParams.put(MediaParam.MEDIA_POSITION, "20");
Webtrekk.getInstance().trackMedia("football123", trackingParams);