Using transport_type "beacon" does not hide parameters in Google Analytics 4

Viewed 363

Maybe I'm missing something here, but in Google Analytics V3 (analytics.js or gtag.js) setting the transport or transport_type to beacon would make the request to google-analytics.com/x/collect be sent using POST, i.e. no GET-parameters would be shown in the request URL.

When using GA4 (and a G- measurement ID) setting this parameter does nothing. This is what my tracking code looks like:

window.dataLayer = window.dataLayer || [];

function gtag() {
    dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXX', {"transport_type":"beacon"});

Am I doing something wrong, or am I simply misinterpreting how the beacon works in GA4? If the latter, is there any way to make GA4 function in a similar manner? What I'd like to achieve is send requests, that look like:

https://www.google-analytics.com/g/collect

As opposed to:

https://www.google-analytics.com/g/collect?param=1&param_2=2&etc=etc

Hopefully someone'll be able to help me out, as the documentation is very limited ATM.

0 Answers
Related