I'm trying to track GA events from python backend for ecommerce analysis. The way it's written in the official documentation, that is sending a post request, nothing shows up, I still have zero visitors in the dashboard, but google replies with 200 and a GIF.
In this example I'm sending a pageview, which obviously makes no sense doing from the backend, but it's simple enough for debugging.
This is my code:
import requests
payload = {
'v': 1,
'tid': 'UA-XXXXXX-Y',
'cid': 555,
't': 'pageview',
'dp': '/home',
}
print 'sending to GA...'
r = requests.post("http://www.google-analytics.com/collect", data=payload)
if r.ok:
print 'ok'
else:
print ':('
I have disabled all filters in GA.
Had the same problem, requests from python did not appear, postman worked. Solved it by removing the checkmark in google analytics under Settings > View > View Settings > Bot Filtering: Exclude all hits from known bots and spiders.
I think it is an authentication problem try using postman and try your post url works or not
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With