AdSense causing changes in WP caching?

Nat

Joined
Nov 18, 2014
Messages
555
Likes
345
Degree
2
Without any ads up, this is a ping. Post using a custom template with some very slight CSS and custom field changes.

without_ads.jpg


Same page, with a few AdSense ads. This was actually a super fast load time, a few other runs it spun up to 4+ seconds. When I expand the "combine external" and parallelism downloads, it isn't just adsense ads, its everything -- plugins, js, etc.
with_ads.jpg


Here's a completely different page, still blog post, using the default blog post template with AdSense ads...:
other_page.jpg


I'm really only using WP Super Cache for optimization. Ideas on whats going on here?
 
Have you checked the page that gave you those second screenshot results with the Inspector? More specifically the Console logs using the inspector for errors.

I wonder if there's a conflict between the Adsense code and possibly another Google script. Maybe adding the same script twice which I usually see a lot of when themes and plugins both include them. I would check there to see if you get any leads.

Who do you use for your hosting if you don't mind me asking? Not related at all, just pretty decent results in your Pingdom tests especially that first one.
 
  • Like
Reactions: Nat
@Jitsiereveld After I realized how buggy I had made things I removed it, but I'll do some testing later tonight, thanks for the suggestions. Theme + plugin definitely didn't include anything twice, but I might have made some type of error. I'm not actually a huge fan of the hosting I'm on, I was getting surprisingly good results this morning.
 
Not sure if you understand how wp super cache works or not, so I explain it anyways.

Pages on your site are cached when either a user visits the page, or you use the preload function in wp super cache. This means if you clear the cache and visit a page for the first time, you aren't getting a cached view that single load. That view creates the cached page that will be served on subsequent loads until the cache is cleared either manually or automatically.

I've seen results like the poor ones you screenshotted when the speed test is the first, uncached load of the page. I run it through again and the cached load has much better results like the good results you have.

Maybe thats whats going on here.
 
The speed variation is because neither Pingdom nor the others run an ad-blocker. They give you a final render time of everything and that includes the ads. But if you visit your site, you'll see the site itself rendered and ready very quickly, then the ads come trickling in later. This is because Adsense is loading asynchronously (if you're not using the old ad code).

Google, on the other hand, doesn't seem to take ads into consideration when it comes to page speed.

Animalstyle pointed out, you as the administrator may not be causing WP Super Cache to generate a cached version, and by default they're generally set to expire and be recached fairly often. But if you've not actually manually done any of this optimization and are relying on WP Super Cache with minimization and combination and other things, then yeah, most of the time your speed tests will pierce that veil and see the truth until you run it a second time.

So part of the problem is nobody is getting the ultra fast browser cached version of anything upon first viewing of our sites. And first impressions matter. If you let WP Super Cache do all of the work, you'll make a really great second impression. The first... not so good.
 
It's important to approach the results of these different page speed testing tools with a discriminating eye. Purely by the numbers, a lot of sites may seem slow, or terrible even. The numbers are not the whole story, however. Most of these tools are utterly indiscriminate with what/how they measure "speed". Although some provide a few features to gain a little bit more of an understanding of the actual rendering behavior and what the possible UX is like, most are a bit limited (at least at a surface level) at really portraying the sense of speed that a user will see.

Case and point. Most of these tools still mention Google Analytics javascript and indiscriminately recommend the same things such as, concatenate and minify, or whatever. Never mind that it's one of the most commonly used, third party scripts. In reality, they should be filtering out, ignoring, and not factoring things like this in to their rating measurements, as it's extraneous.

For example, as Ryuzaki mentioned, the difference between synchronous and asynchronous javascript loading. Also, things like "flash of unstyled text" (FOUT). Taking it even farther, look at apps and highly dynamic sites using modern JS frameworks (Angular, Ember, Meteor, React, etc.), which may have a significant degree of functional components that are loading and refreshing constantly. Looking at the tools, you'd think some of these sites were insane. Using the actual sites, the nature may be that everything appears fast and seamlessly loads at just the right time in the background, providing a great and interactive experience.

So which is more appropriate to base decisions on? With page speed optimization, once you've taken care of the low hanging fruit and have most of your performance fundamentals are accounted for, you'll want to transition towards optimizing performance based on how it influences ROI as opposed to the general recommendations of any one tool.
 
  • Like
Reactions: Nat
And first impressions matter. If you let WP Super Cache do all of the work, you'll make a really great second impression. The first... not so good.

WP super cache does have a cache warming function to remedy this. I believe it's called pre-cache or something similar. You set the plugin to generate the entire site cache on a schedule. It runs through the whole site so that all first visits to a page are getting cached versions.
 
Lots of replies, so I'm not gonna quote everyone.

@animalstyle thanks for the response, I did know that although my knowledge of caching definietly has holes in it. I had all pages pre-cached I believe, plus I ran the pages through the ping tool like 15 times lol & from diff locations to make sure that wasn't an issue.

@Ryuzaki what really confused me was that once the AdSense was added, the ping tool was showing all sorts of other css and js files were no longer cached. And this was after pre-loading with WP super, and running the test multiple times anyway.

@turbin3 as always, that's some next level stuff... I need to figure out better ways to optimize for user experience.

My main concern here has been that I wrote some custom page templates that were somehow very inefficient, or somehow aren't being cached. But, since no one has really addressed that, I'm assuming that my coding skills aren't at fault..
 
Back