I'm trying to use navigator.sendBeacon
as the transport mechanism for my GA script in order to asynchronously transmit hits to the web server without having to set a hit callback. However, Google Tag Assistant is throwing a No HTTP response detected error when I attempt to use it. It responds fine when I use 'image'
or 'xhr'
as the transport mechanism, it's just when I use 'beacon'
that it throws the error.
Here is a snippet of my tracking code that I have implemented:
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};
ga('create', 'UA-XXXXX-Y', 'auto');
ga('set', 'transport', 'beacon');
ga('send', 'pageview');
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
Any help would be much appreciated. Thanks!