简体   繁体   中英

Google Analytics Measurement Protocol Sale Not Showing

I'm trying to use the google analytics measurement protocol ( https://developers.google.com/analytics/devguides/collection/protocol/v1/reference ) to send enhanced e-commerce data, but the hits are not showing up and I don't really know how else to ask for help. I'm using the python requests library to send the data like so:

HTTP POST

Url:

https://www.google-analytics.com/collect

Headers:

'User-Agent': 'python-requests/2.18.4'

payload:

{
'cid': 'e60da0b9e312442fb1fe3e30c0f2d679', 
'ea': 'Confirmed Booking', 
'ec': 'Booking', 
'el': 'SpeediShuttle-Shared Ride Van-oneway-from-HNL', 
'ev': 18, 
'pa': 'purchase', 
'pr1br': 'SpeediShuttle', 
'pr1ca': 'Shared Ride Van', 
'pr1nm': 'SpeediShuttle-Shared Ride Van-oneway-from-HNL', 
'pr1pr': 18.16, 
'pr1qt': 1, 
'pr1va': 'oneway-from-HNL', 
't': 'event', 
'ta': 'Airportshuttles.com', 
'ti': '2IIMVM.GO', 
'tid': 'UA-10350251-1', 
'tr': 18.16, 
'ts': 0.77, 
'tt': '1.17', 
'v': 1, 
'z': 707523808
}

Is there anything obvious that I'm doing wrong?

If you take a look at the documentation , you see that the payload is supposed to be in FormData format, and not json. I don't think it will accept json, but to be sure your request is okay, you could verify your request by changing the endpoint to '/debug/collect' (see the docs )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM