Google Analytics Measurement Protocol - 数据在实时分析中显示并消失
Google Analytics Measurement Protocol - Data Shows in Real Time Analytics and disappears
我希望有人能帮助阐明这里发生的事情,我已经束手无策,担心我看这个问题的时间太长了。我已经上下搜索但没有找到解决问题的方法。
我的 C# 应用程序正在使用 Google 分析测量协议记录 "pageviews"。 (我没有使用传统方式,因为大多数提供的文档都不是 HTML,而是直接链接到的。)
背景有限,我有一个问题,"hits" 在 Google Analytics Real Time 中看到,但在 Analytics 中没有显示,我已经等了一天,并且然后是另一个,然后是一周,没有数据存在。我什至在 Analytics 中设置了一个新的 属性,但没有成功。
我在下面首先包含了发送请求的代码(两条注释行用于在调试时检索输出——它们在生产代码中被删除):
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);
}
正在发送的数据如下,域名、UID、IP已经混淆:
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=
启用后的调试响应如下:
{
"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."
} ]
}
显然我遗漏了一些东西,希望人群的智慧可以帮助指出我遗漏的东西。提前谢谢您,请让我知道我提供的其他可能有用的信息。
CID 是一个未记录的必需参数。我将再次尝试 Google 修复文档中的这个错误,但我最后一次尝试没有成功。
我希望有人能帮助阐明这里发生的事情,我已经束手无策,担心我看这个问题的时间太长了。我已经上下搜索但没有找到解决问题的方法。
我的 C# 应用程序正在使用 Google 分析测量协议记录 "pageviews"。 (我没有使用传统方式,因为大多数提供的文档都不是 HTML,而是直接链接到的。)
背景有限,我有一个问题,"hits" 在 Google Analytics Real Time 中看到,但在 Analytics 中没有显示,我已经等了一天,并且然后是另一个,然后是一周,没有数据存在。我什至在 Analytics 中设置了一个新的 属性,但没有成功。
我在下面首先包含了发送请求的代码(两条注释行用于在调试时检索输出——它们在生产代码中被删除):
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);
}
正在发送的数据如下,域名、UID、IP已经混淆:
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=
启用后的调试响应如下:
{
"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."
} ]
}
显然我遗漏了一些东西,希望人群的智慧可以帮助指出我遗漏的东西。提前谢谢您,请让我知道我提供的其他可能有用的信息。
CID 是一个未记录的必需参数。我将再次尝试 Google 修复文档中的这个错误,但我最后一次尝试没有成功。