1
votes

I'm trying to send batch hits to Google Analytics Measurement Protocol, following directions from this link:

https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide

My post data is as follows:

POST /batch/ HTTP/1.1
Host: www.google-analytics.com
Cache-Control: no-cache

v=1&tid=UA-XXXXXXXX-XX&cid=57409376.1490567764&t=transaction&ti=21594451&tr=29.4&tt=0.0&ts=0.0&cm4=7.350000000000003&cu=BRL&pa=purchase&pr1id=58d279b0e4b069eb07461b&pr1nm=credito&pr1ca=Divers%C3%A3o&pr1qt=3&pr1cc=&pr1pr=9.8&pr1cm2=0.01&cd12=22882
v=1&tid=UA-XXXXXXXX-XX&cid=742537347.1490876083&t=transaction&ti=21594452&tr=24.9&tt=0.0&ts=0.0&cm4=4.979999999999997&cu=BRL&pa=purchase&pr1id=58cadfa0e4b094f81b742c&pr1nm=show&pr1ca=Divers%C3%A3o&pr1qt=1&pr1cc=&pr1pr=24.9&pr1cm2=0.01&cd12=28439

When I send this to Google Analytics, it returns me HTML code, like this:

<!DOCTYPE html>
<html class="google mmfb" dir="ltr" lang="en">
    <head>
        <script>
    (function(H){H.className=H.className.replace(/\bgoogle\b/,'google-js')})(document.documentElement)
</script>
    <meta charset="utf-8">
    <meta content="initial-scale=1, minimum-scale=1, width=device-width" name="viewport">
    <title>
  Google Analytics Solutions - Marketing Analytics &amp; Measurement – Google
</title>

This is a fraction of the result I get when I send my batch post to Analytics. And my data isn't sent to analytics. I see no hits in my transaction report.

Am I missing something?

1

1 Answers

0
votes

You need to remove the ending slash.

The endpoint is www.google-analytics.com/batch