Using WP Rocket with Advanced Ads

After over a decade of managing websites, it feels like a déjà vu when Google announces that page speed is important for websites. Thankfully, there are tools like WP Rocket that can help you. Publishers who use AdSense or other ad networks still need to know a few things when using WP Rocket’s rich feature set.

In a nutshell

  • If you want to increase your website’s performance score, we recommend a tool like WP Rocket – we use it on this very site.
  • Advanced Ads and its add-ons are compatible with WP Rocket’s Delay and Defer features.
  • Ads that load external content, like AdSense and other ad networks, will always have a negative impact on performance scores.
  • Use the Delay option with caution: ads that pay per impression are likely to make less money.
  • Use the Lazy Load option in Advanced Ads Pro to delay only ads that are placed lower on your site.
  • Using Delay and Defer together does not have a performance benefit and could break scripts. Choose one of them.

It is impossible to reach a performance score above 80 if you use AdSense on a website.

Entering WP Rocket

Every second year or so, we look into some page speed tool and try to improve whatever score they give us.

What changed over time are the score definitions and tools to “solve” the performance drains.

Ten years ago, we had to implement caching, script minification, or lazy loading with some custom code that only rocket scientists could control.

To stay with the metaphor, these rocket engineers now built us a handy tool to speed up our websites with an easy-to-understand interface: WP Rocket.

We are using WP Rocket on this very website for many years and it is the tool I recommend to anyone who has a budget for premium plugins.

However, as simple as it is to enable a particular option, we learned in a couple of hard lessons that a basic technical understanding is needed to not accidentally break a website.

Especially publishers who use AdSense and other ad networks should be aware of the impact that some options of WP Rocket can have on their revenue.

WP Rocket options to optimize JavaScript files.
WP Rocket options for JavaScript file optimization

Becoming a high scorer

I know how addictive it can be to go for a perfect performance score. We worked through a couple of items when we saw our website scoring less than 100 in Google PageSpeed Insights. Doing so, we even discovered and reported a bug in WP Rocket, which is fixed now.

The last time I checked, our performance score was around 90. Thanks to cleaning up unused plugins and WP Rocket’s caching and script optimization features.

Page Speed Insights report for the Advanced Ads Homepage
Advanced Ads homepage page speed score. Also thanks to WP Rocket.

Reaching such a score is relatively easy if your website is static and doesn’t load (many) external resources.

It is impossible to reach a performance score above 80 if you use AdSense on a website. At least not with whitehead technologies and without sacrificing revenue.

Believe me, we tried. Not just for our users but especially when running our own ads-monetized websites with over 40 million monthly page impressions.

Back then, I learned a few lessons about page speed:

  1. Your website can feel fast to your visitors and still score badly in technical performance tests. Focus on the first.
  2. Your website can score badly and still outrank your competitors.
  3. If scores are important to you, base your expectations on your competitor’s score, not on the highest possible score.

Load JavaScript deferred

WP Rocket comes with an option called “Load JavaScript deferred”.

It postpones all scripts until the content of your site is loaded. When the option is enabled, the “Eliminate render-blocking resources” check in Google PageSpeed insights shows fewer lines.

WP Rocket option: Load JavaScript deferred
WP Rocket option: Load JavaScript deferred

defer is a standard HTML attribute. It can be used safely for any scripts that are not essential early when loading a given site.

Deferring scripts has a similar effect as moving all scripts to the footer of your website or using the async attribute. The benefit of using the option within WP Rocket is that it will be applied to all scripts simultaneously. This keeps the order intact and prevents dependencies from failing.

The impact of using the defer option on ads is a possible delay in their visibility. When a significant amount of your visitors leaves your site early, this could impact revenue from ads that pay per impression.

In my experience, AdSense still loads fast enough when defer is enabled. Since they are paying per click, users who stay on your site still have a good chance to see and click on the ads.

Delay JavaScript execution

With version 3.9, WP Rocket completely changed the “Delay JavaScript execution” option.

Before that, you had to manually select the scripts that should be delayed. Now, when enabled, all JavaScript files are delayed.

New WP Rocket users have this option enabled by default.

WP Rocket option: delay JavaScript execution
WP Rocket option: Delay JavaScript execution

Even though “delay” and “defer” sound similar – and I have confused them more than once – they work differently. Though in the end, both have the same positive effect on performance scores.

The Delay option will prevent any script files and code blocks from loading until the user does something. This includes (AdSense) ads and other elements that load right away on your site.

On desktop devices, moving your mouse cursor already counts as user interaction and would trigger the ads to load.

After moving the mouse cursor on a website, ads start showing up above the content and in the right bottom corner.
The Delay option in WP Rocket loads scripts when the user interacts with the site. This could lead to ads not showing up right away.

Still, they might read your site before doing anything and close the tab without seeing an ad. If they stay, they might experience what Google calls a Cumulative Layout Shift.

On touch screens, the visitor could easily scroll and never see the ad in the upper part of your website to load.

That being said, using the Delay option in WP Rocket might significantly impact your ad revenue.

… using the Delay option in WP Rocket might have a significant impact on your ad revenue.

The described effect only happens to ads that use scripts. This includes AdSense and other ad networks, as well as ads delivered using our add-ons for sticky or popup placements and Cache Busting.

Use Lazy Load instead

An alternative to the Delay option in WP Rocket is Lazy Load in Advanced Ads Pro.

This feature would load ads above the fold without a delay while loading the rest of the ads only when the user scrolls to them.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required
Interests

Using Defer and Delay together

We have been working hard to make Advanced Ads compatible with WP Rocket’s new features so that our scripts are neutral on the performance scores.

However, using Defer and Delay together breaks our and many other scripts.

Either function can be used to get the same performance benefit though, so there is no need to use them together.

If you want to enable both options then you need to exclude certain scripts from or used by Advanced Ads. You can add them to the “Excluded JavaScript Files” option under “Load JavaScript deferred”:

/jquery-?[0-9.](.*)(.min|.slim|.slim.min)?.js
/jquery-migrate(.min)?.js
/uploads/(.*).js
advanced_ads_ready
advadsCfpQueue
/advanced-ads(.*)
advads_items
advads_tracking_ads
advadsTrackingScript
advanced-ads-pro
advadsGATracking

If you are using AdSense ads with WP Rocket, you might also want to exclude the AdSense-related scripts:

adsbygoogle

20% discount for WP Rocket

All Access clients find a 20% discount for WP Rocket on the Deals page in their customer account. We believe in the WP Rocket team and are not getting a commission to share this unique discount.

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.