mirror of
https://github.com/huiyadanli/RevokeMsgPatcher.git
synced 2025-05-23 22:06:06 +08:00
[#] GA4 修复无用户计数的问题
This commit is contained in:
parent
c503d8c566
commit
e3dc309502
|
@ -50,7 +50,7 @@ namespace RevokeMsgPatcher.Utils
|
||||||
|
|
||||||
public GAHelper()
|
public GAHelper()
|
||||||
{
|
{
|
||||||
UserAgent = string.Format("Hui Google Analytics Tracker/1.0 ({0}; {1}; {2})", Environment.OSVersion.Platform.ToString(), Environment.OSVersion.Version.ToString(), Environment.OSVersion.VersionString);
|
UserAgent = $"Hui Google Analytics Tracker/1.0 ({Environment.OSVersion.Platform.ToString()}; {Environment.OSVersion.Version.ToString()}; {Environment.OSVersion.VersionString})";
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RequestPageViewAsync(string page, string title = null)
|
public async Task RequestPageViewAsync(string page, string title = null)
|
||||||
|
@ -68,20 +68,27 @@ namespace RevokeMsgPatcher.Utils
|
||||||
{ "client_id",UserAgent},
|
{ "client_id",UserAgent},
|
||||||
{ "user_id", cid },
|
{ "user_id", cid },
|
||||||
{ "non_personalized_ads", "false" },
|
{ "non_personalized_ads", "false" },
|
||||||
{ "events", new List<Dictionary<string, string>>()
|
{ "events", new List<Dictionary<string, object>>()
|
||||||
{
|
{
|
||||||
new Dictionary<string, string>()
|
new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ "name",page},
|
{ "name",page },
|
||||||
|
{
|
||||||
|
"params",
|
||||||
|
new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
{ "engagement_time_msec", "1"},
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
var serializer = new JavaScriptSerializer();
|
||||||
string json = serializer.Serialize(values);
|
var json = serializer.Serialize(values);
|
||||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
var response = await client.PostAsync(GAUrl, content);
|
var response = await client.PostAsync(GAUrl, content);
|
||||||
Console.WriteLine(response.ToString());
|
// Console.WriteLine(response.ToString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user