kalnyc67 / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 0 forks source link

HitBuilders.HitBuilder.html.setCampaignParamsFromUrl() fails to parse URLs generated by the Google Play URL builder #596

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
---------------------------------------------------------------------------
NOTE: This issue tracking system is for Google Analytics developer products
only.
If you are not a developer/programmer visit:
http://www.google.com/analytics/support.html
---------------------------------------------------------------------------
Name of affected component: Mobile Tracking

Name of related library and version, if applicable (e.g. Android, iOS,
Snippets, etc.):
Google Analytics SDK v4 for Android

Issue summary:

HitBuilders.HitBuilder.html.setCampaignParamsFromUrl() fails to parse URLs 
generated by the Google Play URL builder [1].

Steps to reproduce issue:
1. Generate a Google Play URL using the Google Play URL builder
2. In an Android application using GA v4, pass this URL to 
HitBuilders.HitBuilder.html.setCampaignParamsFromUrl() and send the hit to GA.

Expected output:
All parameters included in the URL should be sent to GA.

Actual results:
The utm_source parameter is not sent to GA. Since this is a required parameter 
all other parameters sent will be ignored by GA.

Notes:
The URL generated by the URL builder has the following form:

https://play.google.com/store/apps/details?id=package-name&referrer=utm_source%3
Dutm-source%26utm_medium%3Dutm-medium...

Which after URL-decoding looks like:

https://play.google.com/store/apps/details?id=package-name&referrer=utm_source=u
tm-source&utm_medium=utm-medium...

It looks like setCampaignParamsFromUrl()[2] takes everything after the ? and 
splits the string on & to get each parameter of the given string.

For the first parameter of the referrer string this results in 
"referrer=utm_source=utm-source".

Then it seems like setCampaignParamsFromUrl() splits that string on = and takes 
the first part as parameter and the second as value giving parameter "referrer" 
and value "utm_source" and referrer is obviously an invalid campaign parameter 
so this is ignored.

[1]: 
https://developers.google.com/analytics/devguides/collection/android/v4/campaign
s#google-play-url-builder
[2]: 
https://developer.android.com/reference/com/google/android/gms/analytics/HitBuil
ders.HitBuilder.html#setCampaignParamsFromUrl(java.lang.String)

Original issue reported on code.google.com by nibar...@gmail.com on 22 Mar 2015 at 12:49

GoogleCodeExporter commented 9 years ago
See also related StackOverflow question: 
http://stackoverflow.com/questions/28932236/how-can-i-set-campaign-with-google-a
nalytics-using-setcampaignparamsfromurl/

Original comment by nibar...@gmail.com on 22 Mar 2015 at 1:23

GoogleCodeExporter commented 9 years ago

Original comment by pfrise...@google.com on 23 Mar 2015 at 6:40

GoogleCodeExporter commented 9 years ago
See Release Version 4.5 - Google Play Services 7.3 (May 1, 2015)
https://developers.google.com/analytics/devguides/collection/android/changelog

Original comment by pfrise...@google.com on 5 May 2015 at 6:52