Campaign Tracking via Deep Links
    • 1 Minute to read
    • Dark
      Light

    Campaign Tracking via Deep Links

    • Dark
      Light

    Article summary

    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

    1. Deep Link Setup: Ensure deep link functionality is configured according to the Android developer documentation.

    2. Campaign Parameter Configuration: In Mapp Q3, set the data source to URL Parameter and use “wt_mc” for tracking campaign media codes.

    3. 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);
    }


    Was this article helpful?