1

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!

Andrew Garrison
  • 182
  • 2
  • 11

1 Answers1

2

I don't think tag assistant can pick up on beacon. Can you confirm if the data is coming through?

XTOTHEL
  • 5,098
  • 1
  • 9
  • 17
  • 1
    Ah, yeah I think you're right. The data is coming through. I tried switching over to use the Global Site Tag (gtag.js) and specifying the beacon this way: (`gtag('config', 'UA-XXXXX-Y', { 'transport_type': 'beacon'});`) and it's working now without errors in the tag assistant. Thanks for your answer. – Andrew Garrison Sep 28 '18 at 20:47