Aakash Anuj
Aakash Anuj

Reputation: 3871

Adding custom tags in google analytics

I am using Google analytics for installation attribution for my app, and I have a URL like this:

https://play.google.com/store/apps/details?id=com.Slack&referrer=utm_source%3Dgoogle%26utm_medium%3Dcpc%26anid%3Dadmob

I am wondering if I can add my own query parameters in the same URL to have something like

https://play.google.com/store/apps/details?id=com.Slack&referrer=utm_source%3Dgoogle%26utm_medium%3Dcpc%26anid%3Dadmob%26mytag%3Dtest

Will this potentially create issues when the play store broadcasts the intent to my receiver, and will the intent also have my own tag which I added in the URL?

Upvotes: 4

Views: 235

Answers (1)

random
random

Reputation: 10309

You can test whether app receives non-utm parameters using adb command to broadcast an INSTALL_REFERRER intent as described in testing play campaigns.

$ cd <path_to_adb_tool>
$ echo 'am broadcast \
    -a com.android.vending.INSTALL_REFERRER \
    -n "your.package.name/path.to.receiver" \
    --es "referrer" \
      "utm_source=test_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name"; \
    exit' | ./adb shell

Try putting custom tag for referrer and see it yourself if it reaches your CampaignTrackingReceiver.

As per General Campaign & Traffic Source Attribution, we can set campaign parameters from url using setCampaignParamsFromUrl

// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
    TrackerName.APP_TRACKER);

// Set screen name.
t.setScreenName(screenName);

// In this example, campaign information is set using
// a url string with Google Analytics campaign parameters.
// Note: This is for illustrative purposes. In most cases campaign
//       information would come from an incoming Intent.
String campaignData = "http://examplepetstore.com/index.html?" +
    "utm_source=email&utm_medium=email_marketing&utm_campaign=summer" +
    "&utm_content=email_variation_1";

// Campaign data sent with this hit.
t.send(new HitBuilders.ScreenViewBuilder()
    .setCampaignParamsFromUrl(campaignData)
    .build()
);

If you have campaign information in a form other than Google Analytics campaign parameters, you will have to send it manually. One way is to use the Google Analytics web interface to configure the custom dimension or metrics and send it as:

// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
    TrackerName.APP_TRACKER);
t.setScreenName("Home Screen");

// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once.
t.send(new HitBuilders.ScreenViewBuilder()
    .setCustomDimension(1, "premiumUser")
    .build()
);

For custom dimensions and metrics reporting note that:

Custom dimensions and metrics are available in custom reports and available for use with advanced segments. Custom dimensions can also be used as secondary dimensions in standard reports.

Upvotes: 4

Related Questions