- 1 Minute to read
- Print
- DarkLight
Campaign Tracking via Deep Links
- 1 Minute to read
- Print
- DarkLight
Campaign tracking through deep links allows you to track users who arrive at your app via a campaign-specific URL. This feature is especially useful for monitoring engagement with campaigns in already installed mobile applications.
Preconditions
Deep Link Setup: Ensure deep link functionality is configured according to the Android developer documentation.
Campaign Parameter Configuration: In Mapp Q3, set the data source to URL Parameter and use “wt_mc” for tracking campaign media codes.
Session Start Configuration: If tracking the request as an event (rather than a page view), make sure your account configuration allows sessions to start with an action request. Contact your Mapp account manager for details.
Implementation
To track the media code (campaign ID) from a deep link, ensure the following code is implemented in the activity specified in your app’s manifest:
val intent = intent
val data = intent.data
val mc = data?.getQueryParameter("wt_mc")
val trackingParams = TrackingParams()
trackingParams.putAll(
mapOf(
Param.MEDIA_CODE to mc!!
)
)
Webtrekk.getInstance().trackCustomEvent("Event Name", trackingParams)
Uri intent = getIntent().getData();
if(intent !=null) {
String mc = intent.getQueryParameter("wt_mc");
Map<String, String> params = new LinkedHashMap<>();
params.put(Param.MEDIA_CODE, mc);
Webtrekk.getInstance().trackCustomEvent("Event Name", params);
}