We are sending the purchase events from the server with code like this:
using (var httpClient = new RestClient())
{
httpClient.SendAsync(new HttpRequestMessage
{
RequestUri = new Uri(url),
Method = HttpMethod.Get
});
}
But around 15-20% of the events never gets registered in GA. Google always seem to respond with a GIF and status code 200, so it is hard to tell which events are not processed successfully.
In the beginning we were using the javascript API to send the event, but when we switched to server side, we copied the request it was creating and tried to replicate it with HttpClient.
The request send looks like the following:
https://www.google-analytics.com/collect?v=1&_v=j47&a=817546713&t=event&ni=0&_s=1& dl=#scheme + host + pathAndQuery#&dp=#path#&dt=#path#&ul=#browser language#&de=#browser encoding#&sd=#bit#&sr=#screen resolution#&vp=#viewable browser area#&cid=#Id taken from the _ga cookie#&je=0&fl=24.0%20r0&ec=Ecommerce&ea=purchase &_u=SCEAAAALI20%25~&jid=&tid=#TrackingId#>m=#TagManagerId#&ti=#OrderId#&ta=& tr=#TotalPrice#&tt=#TotalTax#&ts=#ShippingPrice#&tcc=#VoucherCode# &pa=purchase&cu=#CurrencyCode#&pr1nm=#ProducteName#&pr1id=#ProductId#&pr1pr=#ProductPrice#&pr1br=#Brand#&pr1ca=&pr1va=#Variant#&pr1qt=#Quantity#&z=#Randomly generated unique id#
Any ideas about what is wrong or how to debug it is welcome