I am using measurement protocol 4 to track desktop application-features. I have sent the event to Google analytic 4 account with measurement ID and API_secret and received to GA4 account.
Request info
POST /mp/collect?api_secret=xxxxxxxxxxxxxxxxxxxxxx&measurement_id=G-xxxxxxxxxx HTTP/1.1
HOST: www.google-analytics.com
Content-Type: application/json
Payload
{
"client_id": "XXXXXXXXXXXXXXXX",
"user_properties": {
"Language": {
"value": "en-us"
}
},
"events": [
{
"name": "license",
"params": {
"LicenseType": "Trial",
"Expiration": "20 OCT 2022"
}
}
]
}
We have sending payload same using "WPF" and "C#" in my desktop app with below codes.
private void SendRequest(string payloadJson)
{
try
{
string url = string.Format(@"https://www.google-analytics.com/mp/collect?measurement_id={0}&api_secret={1}", mesurement_id, api_secret);
HttpWebRequest httpWebRequest = WebRequest.Create(url) as HttpWebRequest;
if (httpWebRequest != null)
{
httpWebRequest.Method = "POST";
var requestBody = Encoding.UTF8.GetBytes(payloadJson);
httpWebRequest.ContentType = "application/json";
using (var requestStream = httpWebRequest.GetRequestStream())
{
requestStream.Write(requestBody, 0, requestBody.Length);
}
using (var response = (HttpWebResponse)httpWebRequest.GetResponse())
{
if (response.StatusCode != HttpStatusCode.OK && response.StatusCode != HttpStatusCode.NoContent)
throw new Exception(String.Format("Server error (HTTP {0}: {1}).", response.StatusCode, response.StatusDescription));
}
}
}
catch (Exception ex)
{
}
}
With above code, I am received event to my google analytic 4 account for above payload. I have observed that Demographic section is empty by sending payload as above method.
Note: sending event to google analytic 3 (Universal Account) using measurement protocol 3 demographics is fill base on received event hit.
I have enabled the google signal to fill the Demographics as per received event. But still details not fill by sending event (I have tried after 48hrs).
Kindly someone help to resolve demographic by sending event.