8

I've been attempting to log activity on a mobile-like device using the Google Analytics Measurement Protocol. All of these attempts have validated using the validation URL, and I can see activity when I look at the real-time reports on the Analytics website. But when I look at the Home or Overview reports for the day - no activity is shown.

The view is set for "All Mobile App Data".

The POST body looks something like this:

v=1&tid=UA-000000000-1&ds=app&qt=1601&uid=uid-zzzzz&t=screenview&cd=Foo&an=Foo%20App%20Name&aid=com.example.foo&aiid=com.example.foo&av=0.0.1&ua=Mozilla%2F5.0%20(Linux%3B%20Android%207.0%3B%20SM-G930V%20Build%2FNRD90M)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.125%20Mobile%20Safari%2F537.36

The ua field is just a pre-defined string. I found that if I omitted it, the Real Time monitoring listed the hits as desktop hits, although I was in a Mobile report and the ds field was "app".

Am I missing a field that is required? Is there some reason why it is showing up in the real-time report, but not in a daily report? Is there some other way to diagnose why the data is vanishing, or confirm the data is actually being captured?

When i check the debug endpoint the hit is valid

Request:

https://www.google-analytics.com/debug/collect?v=1&tid=UA-XXX-1&ds=app&qt=1601&uid=uid-zzzzz&t=screenview&cd=Foo&an=Foo%20App%20Name&aid=com.example.foo&aiid=com.example.foo&av=0.0.1&ua=Mozilla%2F5.0%20(Linux%3B%20Android%207.0%3B%20SM-G930V%20Build%2FNRD90M)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.125%20Mobile%20Safari%2F537.36

Response

{
  "hitParsingResult": [ {
    "valid": true,
    "parserMessage": [ ],
    "hit": "/debug/collect?v=1\u0026tid=UA-53766825-1\u0026ds=app\u0026qt=1601\u0026uid=uid-zzzzz\u0026t=screenview\u0026cd=Foo\u0026an=Foo%20App%20Name\u0026aid=com.example.foo\u0026aiid=com.example.foo\u0026av=0.0.1\u0026ua=Mozilla%2F5.0%20(Linux%3B%20Android%207.0%3B%20SM-G930V%20Build%2FNRD90M)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.125%20Mobile%20Safari%2F537.36"
  } ],
  "parserMessage": [ {
    "messageType": "INFO",
    "description": "Found 1 hit in the request."
  } ]
}

I cannot use one of the mobile libraries from Firebase - this is not one of the platforms they support. I do not wish to pretend this is a web page - there is no associated hostname or path. I do not wish to use Events since I can't do event Behavior Flow, which is one of the things I'm interested in seeing.

I'm aware that it can sometimes take "a day or so" for results to first appear. The site was setup over five days ago at this point, and has received data during that time.

Good thought about the anti-spam setting, however the setting appears to be correct:

enter image description here

I've also tried using GET instead of POST - no change, it still shows the hit in real-time, but then it vanishes.

However, I know that it can record hits permanently. There were two hits from a spammer in Russia that have shown up in the daily report (I wasn't there to see it show up in real-time). I don't know what they did, but would love to find out since it might help figure out how I can add a record.

In the real-time reports, it correctly points out the data center all the hits are coming from. Perhaps that is filtering it out somewhere out of my control?

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • You have to wait 48 hours sometimes for a new account, is it ok now? Otherwise I have had trouble before if you have the "remove spam bots" button clicked in the View settings - try turning that off its on. – MarkeD Nov 22 '17 at 22:51
  • Good thoughts! However, it's been several days since the site was up and started getting data. I didn't even post the question for a few days, knowing that things can lag. And I just verified - settings have Bot Filtering off. Updated question to reflect. – Prisoner Nov 22 '17 at 23:06
  • The ds parameter doesn't determine which device it shows up as, just the method data comes in. (E.g. offline/CRM/etc) so I think it's an unrecognized mobile user agent. – MarkeD Nov 23 '17 at 07:26
  • As noted, before I added the ds parameter, it showed up as desktop. With the one listed (which I got from... somewhere... I'll find the page I used and link to it) it shows up as mobile in the real-time activity, but doesn't show up in the daily reports. So it would seem to recognize it at this point - just not store it. – Prisoner Nov 23 '17 at 11:07
  • Its recently moved to Firebase for setting up mobile apps, do you have the property connected to Firebase? There may be an issue with updating documentation – MarkeD Nov 23 '17 at 11:16
  • I guess confirm the user agent is mobile, perhaps try another you know works. A work around would be to also send the data in as a custom dimension instead, so you can use that to see devices in the reports. – MarkeD Nov 23 '17 at 11:34
  • As noted in an update to the question, I cannot use Firebase because they don't support the platform in question. – Prisoner Nov 23 '17 at 11:43
  • The user agent is mobile, but I'm happy to put in any other user agent if that would work. I'm not sure I follow how the workaround you describe would work - I plan to put information in custom dimensions... but I won't do so until I know the hits are actually being recorded. I have no evidence they are yet. – Prisoner Nov 23 '17 at 11:45
  • Question updated with some additional facts and things that didn't work. – Prisoner Nov 24 '17 at 11:30
  • Oooh are they debug hits? Those won't show up. Just eliminating possibilities :) – MarkeD Nov 24 '17 at 19:01
  • 1
    If you mean "are they sent to https://www.google-analytics.com/debug/collect"? Then no. I do send them to that URL to verfiy, but then I send them to the correct URL as well. Remember, they *do* show up as real-time hits, but vanish after they fall off the real-time chart. Nice try! {: – Prisoner Nov 24 '17 at 19:12
  • I had a similar issue. Dis you try with parameter "ni=1" (non-interaction hit)? https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ni – Guillaume Nov 29 '17 at 00:16
  • I was really hopeful on this one, but just adding "ni=1" didn't seem to do the trick. – Prisoner Nov 29 '17 at 21:14

1 Answers1

3

Try adding Cid I know it says this is an optional parameter but for mobile accounts I belive it may be required.

Client ID

Optional.

This field is required if User ID (uid) is not specified in the request. This anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in http://www.ietf.org/rfc/rfc4122.txt.

Example value: 35009a79-1a05-49d7-b876-2b884d0f825b

Although this says it needs to be a UUIDv4, it does work with other UUIDs (I've tested it with a v5, which is a hash against the value used for the uid parameter).

Community
  • 1
  • 1
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449