Reputation: 11
I have been going though the documentation for the Universal analytics measurement protocol
I have gotten theurl and parameter, now I have a question is that how I can make a HTTP request with CURL, here is my request:
curl https://www.google-analytics.com/collect -d v=1&tid=UA-123456-1&cid=5555&t=pageview&dp=%2FpageA
Error:
Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: " to save to a file.
Can you tell me what is wrong in my request?
Upvotes: 1
Views: 1027
Reputation: 117261
I would test it with the debug endpoint first.
curl 'https://www.google-analytics.com/debug/collect?v=1&tid=UA-123456-1&cid=5555&t=pageview&dp=%2FpageA'
The response says its all good.
{
"hitParsingResult": [ {
"valid": true,
"parserMessage": [ ],
"hit": "/debug/collect?v=1\u0026tid=UA-123456-1\u0026cid=5555\u0026t=pageview\u0026dp=%2FpageA"
} ],
"parserMessage": [ {
"messageType": "INFO",
"description": "Found 1 hit in the request."
} ]
}
Followed by sending the actual hit.
curl 'https://www.google-analytics.com/collect?v=1&tid=UA-123456-1&cid=5555&t=pageview&dp=%2FpageA'
Upvotes: 0