I want to track an application that runs in different environments:
In order to use one tracking mechanism for all I thought it would be a good idea to use the "Measurement Protocol"
I set up a new tracking property (type Website) and performed multiple requests to the www.google-analytics.com/collect
site as described in their devguide. I always get the Status 200 (OK)
from my POST request, but unfortunately I can´t see any tracking information coming in to my GA account.
Here is what the request looks like (Build with Postman plugin for Chrome):
POST /collect?v=1&tid=UA-29xxxxxx-2&cid=35009a79-1a05-49d7-b876-2b884d0f825b&t=pageview&dh=mysite.com&dp=%2Fhome&dt=Homepage&an=myapp HTTP/1.1
Host: www.google-analytics.com
Cache-Control: no-cache
Basically I´m sending these parameters:
v=1
&tid=UA-29xxxxxx-2
&cid=35009a79-1a05-49d7-b876-2b884d0f825b
&t=pageview
&dh=mysite.com
&dp=%2Fhome
&dt=Homepage
&an=myapp
I also tried to create a "Mobile Application" in Google Analytics and use that tracking id instead. Same result here - no tracking information in Google Analytics.
Does anyone know, how to perform this tracking requests successfully or if there is a debug-option so that I can at least see, why the tracking call is not saved? Thanks!
The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers. This allows developers to measure how users interact with their business from almost any environment.
By dual tagging you can keep your Universal Analytics implementation in place while you build out your Google Analytics 4 implementation.
To see if Google Analytics is firing on your page, go to any page on your site in your Chrome Browser and right-click. Click on Inspect. Then go to the Network tab. Hit refresh on your browser and watch to see the different content and scripts loading on the page.
Had the same problem: whatever I POSTed, it did not show up in GA. Debug API successfully validated my hits. Finally, I found out what was missing: you must send a user agent string (parameter ua), too.
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