Guess Who – Client Errors!
Recently I have received an interesting theme of questions related to client errors. These are errors that happen as your site is trying to make requests for various tags that should be included on the page but the browser (aka “the client”) shuts them down for one reason or another. These errors always negatively impact whatever systems was depending on that tag. Most of the time these errors don’t have a notable impact on the user experience but sometimes they do so in generally it is best to prevent these from happening.
Here are three errors for you to gander at. Try just looking at the error and see if you can guess at what is causing the problem. Then compare that to my description below.
Refused to load the script…violates the following Content Security Policy directive
In this case the team was trying to implement Google Tag Manager on a new application that had fairly stringent security measures in place. This is the sort of error that completely ruins whatever a script may want to do so best to resolve it right away.
For this error you mostly just need to know that a site can declare a Content Security Policy (“CSP”) that determines what content on the site is allowed to do and what scripts can be included. Some sites don’t have a CSP which pretty much allows you to run scripts freely. In this case a CSP was in place and because GTM wasn’t included in their GCP it was blocked and unable to deliver any of the many important tags that it needed to.
To resolve this issue the developers just had to update the CSP to include googletagmanager.com and then GTM started working. But don’t stop there…because GTM will include other tags that each run their own scripts you should also do an audit of all your potential tags and ensure that each of their script libraries are part of your CSP. If not, then GTM will try to fire your tag but the browser will reject it.
Mixed Content: The page…requested an insecure script
For this one the page was trying to include a tag but it was getting shut down by the security police!
This one is fairly self explanatory. Pages that use a secure, HTTPS page should also use tags that run on HTTPS. If they don’t then they will be blocked. Typically I just see this happen if a user is running a tag outside of a tag management systems or using custom scripting in the TMS. The tagging templates that TMSs provide will handle this for you.
To fix this one just update your code to dynamically use the HTTPS version of the tag on pages using HTTPS. Somewhere in the tag code there is likely a reference to a JS file and you’ll see “http” being used as the protocol which is typically where your update will happen. Keep in mind that most of the time you can just change “http” to “https” or just use the relative “//” reference. Be careful, though, because sometime other parts of the URL may need to change to properly reference the secure version of the tag. These details can be provided by whatever vendor that tag belongs to.
Here we have a big mess of errors and all have the same “net::ERR_BLOCKED_BY_CLIENT” message. This was pretty much happening to every tag and it looked as if the whole tagging setup was imploding!
Remember, if you see “client” in the error that refers to your browser. This error is basically saying that the browser blocked the request from happening. The other interesting point about this error is that it didn’t show for me when I took a look at the same page. So I made a suggestion for something my client could check for and, sure enough, he found that he had an ad blocker installed and the ad blocker was shutting down all of his tags. Fortunately, this just impacts what he was seeing and not all users to the site. Simply disabling the blocker solved the issue for him.
Note that while there is a negative impact to the tag here there isn’t anything you can do about what people have installed on their browser. Best to understand it but not sweat it 🙂
Well, I hope that helps to give a little context on a few client errors you may run into. What other errors would you include in this list?