Search code examples
google-analyticsmeasurement-protocol

Google analytics measure protocol event tracking stopped working


I have a script which runs on my server every time and event happens. This randomly has stopped working on the 1st/2nd July. I have checked the Analytics change history and the last change was April.

The code has not changed and i'm not getting any errors from the request.

data = {
    'v': '1',
    't': 'event',
    'tid': 'UA-XXXXXX-X',
    'cid': '11111111.2222222',
    'ec': 'ccccc',
    'ea': 'aaaaa',
    'el': 'lllll',
    'ev': 50
}

response = requests.post('http://www.google-analytics.com/collect', data=data)
response.raise_for_status()

This returns no errors and has a status code of 200, but just does not show up anymore in analytics. I also tried the measure hit builder tool with the same params and it sent 2 hits successfully.

How can I debug this?


Solution

  • Try and send your request to

    google-analytics.com/debug/collect   
    

    This will help you debug the problem. The request you are sending appears to be valid.