I'm struggling to understand why this javascript error keeps popping up on my website and I can't reproduce it. I've followed the bing documentation to install their tracking pixel so I have this in my header :
<script>
(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){
var o={ti:"xxxxxxxx"};o.q=w[u],w[u]=new UET(o),
w[u].push("pageLoad")},n=d.createElement(t),n.src=r, n.async=1,
n.onload=n.onreadystatechange=function(){var s=this.readyState;
s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},
i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})
(window,document,"script","//bat.bing.com/bat.js","uetq");
</script>
However in some browsers, the UET variable in this code, which is loaded by the url given as the r variable, seems to not be defined while it's only called when the url is loaded...
If anybody can make sense of it before I reach out to bing, I'll be very thankful!
Ad/tracker blocking.
If the user blocks the domain bat.bing.com, then UET never gets defined.
For example, FireFox console on accessing a website that contributes to Bing tracking while blocking such things:

As for 'fixing' it, in my view the most appropriate fix is to ignore it*. If you're seeing it in Sentry.io or similar, the single occurrence can be ignored rather than all undefined variable errors (which of course you wouldn't want to blanket-ignore).
The user is deliberately blocking it, and the error isn't user-visible, (without opening the console) so nothing to worry about.
*Of course, you could always not load trackers for any of your users ;)
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