paullangtree / analytics-issues

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

HitBuilders.HitBuilder.setCampaignParamsFromUrl() always sets gclid with empty value #799

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
---------------------------------------------------------------------------
NOTE: This tool is not designed to request help. It is only for
reporting issues and requesting features for the Google Analytics
libraries.

If you are a developer and you need help, visit:
https://developers.google.com/analytics/help/

If you are not a developer and you need help, visit:
https://support.google.com/analytics
---------------------------------------------------------------------------
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, 
play-services-analytics:8.1.0 (same in 8.3.0)

Issue summary:
HitBuilders.HitBuilder.setCampaignParamsFromUrl() always sets gclid (also anid, 
dclid, aclid, gmob_t) with empty value even if the params are not present in 
the input url. This leads to custom campaign tracking not to work because 
Google Analytics server replaces custom source and medium by google / cpc. 

Steps to reproduce issue:
1. Excute 
HitBuilders.HitBuilder.setCampaignParamsFromUrl("http://?utm_source=email&utm_me
dium=email_marketing&utm_campaign=summer&utm_content=email_variation_1")
2. Build the Builder via build()
3. Print/check the entries of the resulting map.

Expected output:
Resulting map does not contain key gclid (anid, dclid, aclid, gmob_t). 
Resulting map only contains keys for campaign params, that are present in the 
input url.

Actual results:
Resluting map contains keys gclid,anid, dclid, aclid, gmob_t with empty values.

Notes:
- Google Analytics SDK v4 for Android Docs 
(https://developers.google.com/analytics/devguides/collection/android/v4/campaig
ns#general-campaigns) instruct to use 
HitBuilders.HitBuilder.setCampaignParamsFromUrl().
- The flowchart at 
https://support.google.com/analytics/answer/6205762?ref_topic=1032998#flowchart 
says that if gclid is present the hit is assumed to be an adwords hit and 
campaign source and medium are shown as google / cpc in the reports. 

Original issue reported on code.google.com by ralp...@gmail.com on 26 Nov 2015 at 12:54

GoogleCodeExporter commented 8 years ago
We are experiencing this issue when using tracked deeplinks
myapp://categories?utm_source=affiliate1&utm_campaign=december15&utm_medium=emai
l

In both real time and source report Google says

source = google instaead of affiliate1
medium = cpc instead of email
campaign = december15 which is correct

In the app logs the correct source/medium/campaign value is passed as well as 
empty gclid

12-07 12:06:36.620 D/GAv4: Hit delivery requested: ht=1449486396613, _s=28, 
_v=ma8.2.98, a=1937889069, aclid=, aid=net.company.package, an=MyApp, anid=, 
av=1.1.1, cc=, cd=Home, ci=, cid=ef7a0ba2-9816-4523-97a2-xxxxxx, ck=, cm=email, 
cn=december15, cs=affiliate1, dclid=, gclid=, gmob_t=, sc=start, sr=1080x1920, 
t=screenview, tid=UA-xxxxx-x, ul=en-gb, v=1
12-07 12:06:36.911 D/GAv4: Hit sent to the device AnalyticsService for delivery

Original comment by jere...@loisirsencheres.com on 8 Dec 2015 at 2:40