Category Technology
Publication date
11 April 2022

Website tracking scripts, more harm than good?

Time to read 5 minutes read

It seems like a good idea to add JavaScripts and tracking code to a website. The can boost functionality, give a site cool features and feed back all sorts of data. But they may also be affecting your site’s performance. And that isn’t good.

We all know the pressure to perform online. You need to know how many visitors are coming to your website, and how they are interacting with it. So you get on to Google Tag Manager, you copy a piece of code, and you embed it into every page of your website. And voilà. The data comes streaming in, giving you all sorts of information on your audience and lets you measure how much bang you’re getting for your buck when it comes to advertising. It even allows you to track your social networking sites and other applications.

But what you may not realise is that these bits of code might also be affecting your site’s performance.

Slow website loading

Third-party JavaScript vendors create scripts for all sorts of applications – analytics, social media buttons, trackers, video player embeds, A/B testing scripts and advertising iframes. The JavaScript can be added to a website by anyone who has admin rights to a website – convenient, yes, but also a potential hazard.

These scripts are great in terms of the functions and user interaction they offer, but they can affect your website’s performance, resulting in your page loading really slowly, which in turn can lead to customer dissatisfaction, increased bounce rates and reduced conversions. They also come with other risks, such as regulatory issues in terms of users’ privacy and security and, because they’re supplied by other companies that don’t necessarily keep you in the loop, these scripts can change without your knowledge.

Regulations and privacy

JavaScript vendors offer users certain features but these scripts can be hijacked by other services so they can do tracking or analysis of the page.

There has been a lot of movement in the EU recently around online tracking and privacy, and cookies, analytics and fonts have all come under scrutiny due to data transfers to the US, so you really need to be aware of what script you’re adding to your websites and what happens to any data they may collect – including IP addresses.

Website tracking scripts

A German court recently ruled that companies cannot use a cookie management provider that relies on a US-based service to collect data. We wrote about issues around cookies recently, including the fines handed to Google and Facebook over their cookies practice and the European Parliament itself that was found guilty of breaching data protection laws and cookie compliancy on one of its internal websites.

Following recent rulings in Europe, Google Analytics is now illegal (Austria) and so is Google Fonts (Germany) because of data transfers to the US (even if it's “only” IP addresses, they still fall under data protection legislation). 

Performance 

At Annertech, what we have often found is that people use these third-party JavaScripts arbitrarily with no consideration of performance. Users tend to copy a piece of code, and embed it into every page of a website, sitewide without limiting it to the URLs that they need to target.  

We often find overlapping tools - three or four tools doing the same job – a Venn diagram of capabilities, if you wish. And although there are four tools that are supposed to target four different things, if you look at the report there will be an overlap. There is a need to be more targeted about what tools are being used.

Each of those tools provides an opportunity for performance improvement. Remember that you will very rarely find a single big performance optimisation. What you will find is lots of micro-optimisations that all add up, and each tracking code or script adds up.

We get pushback from both clients and the creators of these tools when we suggest a performance change. The argument is usually that it isn’t worth it, it will only save a tiny bit in terms of performance, and that’s generally true. The problem is that you need to save lots of tiny bits in order to make a dent in the overall performance. And this is especially problematic when dealing with third-party JavaScript vendors. 

The people who create these tools don’t care too much for performance because it’s not their problem. They’ll say theirs is fine, but Annertech team has gone back and found ways to make significant improvements.

So how do you know which ones are causing the problems and how much they are affecting your site?

Unless you’re aware which third-party scripts are loaded by your site and what their performance impact is, it’s impossible to know how to optimise them. 

Many free web speed test tools can give you this information, including Chrome DevTools, PageSpeed Insights and WebPageTest. They can tell you how many third-party scripts are loaded by your site and which take the most time to execute.

Once you have identified whether there any scripts slowing down the site you can have a look at the ones that are taking the longest and see if they can be tweaked, made asynchronous or compressed to make downloading and rendering quicker.

When that is done, make sure to keep monitoring the performance of your scripts and communicate with your third-party providers. The web changes constantly and there are no guarantees of a script’s performance a few months down the line.

In conclusion

The bottom line is that third-party scripts need to be used with discretion. They can be a cause of performance slow-downs and these are often caused by resources outside of your control. And with data protection finally getting the recognition it deserves in courts across the EU, you don’t want to be caught on the wrong side of the law.

Are third-party scripts bogging down your site?

Let us see what’s going on, streamline things and get your website performing the way it should.

Profile picture for user Alan Burke

Alan Burke Director of Technology

As Director of Technology, Alan plans and architects solutions to the complex problems Annertech solves on a daily basis.