Reputation: 70
I'm sending an event
request to Google Analytics server-side using a POST request to https://www.google-analytics.com/collect
from Python/Flask (via the requests
library). I'm testing it by looking at the real-time events page.
If I try my request on the GA Hit Builder, it works perfectly.
If I paste the request directly into my browser with the URL parameters, it works perfectly.
If I post from my app, I get a status 200, suggesting it has worked, but nothing appears in the live events view.
If I post from my app to /debug/collect
I get this response, which looks OK to me, but nothing in the live events view:
{
"hitParsingResult": [ {
"valid": true,
"parserMessage": [ ],
"hit": "/debug/collect?v=1\u0026tid=UA-18542058-16\u0026cid=ax5b51b5beaa4f0\u0026t=event\u0026ec=Tasks\u0026ea=View task\u0026el=25\u0026ev=0"
} ],
"parserMessage": [ {
"messageType": "INFO",
"description": "Found 1 hit in the request."
} ]
}
The request is: https://www.google-analytics.com/debug/collect
v=1&tid=UA-18542058-16&cid=ax5b51b5beaa4f0&t=event&ec=Tasks&ea=View+task&el=25&ev=0
.
I cannot figure out what I'm doing wrong here. Any ideas?
Upvotes: 1
Views: 474
Reputation: 14179
Try to specify dl
(document location URL) parameter in the hit or both dh
(document host name) and dp
(document path) parameters:
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=it#dl
Alternative disable any filter in the view and the tick to exclude bots.
Upvotes: 1