I am hoping someone can help shed some light on what is going on here, I am at my wits end and fear I have been looking at the problem too long. I have searched up and down without finding a resolution to the issue.
I have C# application that is recording "pageviews" using the Google Analytics Measurement Protocol. (I am not using the traditional means as most of the documents served are not HTML and are linked to directly.)
What that limited background, I am having an issue where the "hits" are seen in Google Analytics Real Time but do not show up from there in Analytics, I have waited a day, and then another and then a week and no data is present. I have even gone as far as to set up a new Property in Analytics without success.
I have included below first the code that is sending the request (the two commented lines are used to retrieve the output when debugging - they are removed in production code):
FormUrlEncodedContent postContent = new FormUrlEncodedContent(new
Dictionary<string, string>() {
{ "v", "1" },
{ "t", "pageview" },
{ "ds", "iis" },
{ "tid", trackingId },
{ "dl", documentLocation },
{ "uip", userIp },
{ "uid", userId },
{ "ua", userAgent },
{ "dr", referrer },
}.ToList<KeyValuePair<string, string>>());
using (HttpClient client = new HttpClient())
{
bool result = client.PostAsync(analyticsUrl, postContent).Result.IsSuccessStatusCode;
//string result = client.PostAsync(analyticsUrl, postContent).Result.Content.ReadAsStringAsync().Result;
//Utility.EventLog.WriteMessageToEventLog(Utility.EventLog.SourceBase + ".Analytics", "Application", result, System.Diagnostics.EventLogEntryType.Information);
}
The data that is being sent is as follows, the domain name, UID and IP have been obfuscated:
v=1&t=pageview&ni=0&tid=UA-xxxxxxxx-2&dl=http%3A%2F%2Fdev.xxxxxxxx.com%2F&uip=97.84.9.2xx&uid=72a0bd81-7664-40d2-a90a-48f357d46afe&ua=Mozilla%2F5.0+(Windows+NT+10.0%3B+Win64%3B+x64)+AppleWebKit%2F537.36+(KHTML%2C+like+Gecko)+Chrome%2F65.0.3325.181+Safari%2F537.36&dr=
And the debug response when enabled is as follows:
{
"hitParsingResult": [ {
"valid": true,
"parserMessage": [ ],
"hit": "/debug/collect?v=1\u0026t=pageview\u0026ni=0\u0026tid=UA-xxxxxxxx-2\u0026dl=http://dev.xxx.com/\u0026uip=xxxxxxxxxxx\u0026uid=72a0bd81-7664-40d2-a90a-48f357d46afe\u0026ua=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36\u0026dr=\u0026_anon_uip=97.84.9.0"
} ],
"parserMessage": [ {
"messageType": "INFO",
"description": "Found 1 hit in the request."
} ]
}
Clearly I am missing something and hoping that the wisdom of the crowds might assist in pointing out what I have missed. Thank you in advance and please let me know what other information I have supply that might be helpful.
CID is an undocumented required parameter. I will attempt again to have Google fix this error in the documentation but my last attempt didn't go through.