Technology

Ad code 'slows down' browsing speeds

Webpage code Image copyright Getty Images
Image caption Poorly written code can make some pages very slow to load

Ads are responsible for making webpages slow to a crawl, suggests analysis of the most popular one million websites.

The research by developer Patrick Hulce looked at which chunks of code take longest to load.

About 60% of the total loading time of a page was caused by scripts that place adverts or analyse what users do, he found.

But using ad-blockers may not be the best way to avoid delays and speed up the loading of webpages, he said.

Bad blocks

Mr Hulce gathered data from both desktop and mobile versions of popular sites on which he sampled programs written in the Javascript language. This is typically used by developers to make sites interactive and also helps them display ads or log what users click on.

He found that the Javascript code helping Google place ads on pages and analyse user activity bestowed the longest delays on visitors. The Javascript behind Google ads and its analytics system were found on the largest number of sites in the million sampled, Mr Hulce told The Register news site.

If used together on a site, these can add more than two-thirds of a second to loading times, he found.

There were some ad-serving scripts written in Javascript that imposed longer delays, but these were used on a much smaller proportion of sites, the analysis found.

The worst offender was the WordAds script for WordPress blogs that, all by itself, can delay the arrival of an entire page by up to 2.5 seconds.

Not all delays were down to ads and analytics, said Mr Hulce. Other factors such as network delays and big file sizes for some content could also contribute to slow loading times.

In addition, he said, greater use of ad-blocking programs may not always improve browsing speeds.

Ad-blockers can end up "triggering convoluted workaround logic and complex disguising of ads that increase script execution time", he told The Register.

Related Topics

More on this story