XF 2.1 Adsense = slow loading speed any theme


When I add Google Adsense with latest Xenforo 2.1 our forum loads very slow. 10 sec+. Remove Adsense, no problems.

Tried this with three different themes, one is the default theme, same result.

One banner below forum overview, and verification code above </head> on the forum below.

Speed check via:


Chris D

XenForo developer
Staff member
You are introducing code that we do not directly interact with or have any control over so if anything this is really just an issue with Adsense itself. There's nothing we can impact here.


Thanks for reply.

So it's a problem on Adsense end? I don't think I will have any luck in making them change anything. Maybe there is something at Xenforos end that's possible to change to make it work better? Or is it 100% on their end.

Chris D

XenForo developer
Staff member
100% not XF, at least. It's their code, loaded from their servers, using your browser, your internet connection etc. XF has no interaction with it.

Mr Lucky

Well-known member
I have never had any problems with Adsense and xenforo (there was was for a while a very slight issue with Google's old responsive code when using after x number of posts, but that was very minor delay years ago on xf1 and via a 3rd party add-on)

I would try uploading one plain html page with nothing but the Adsense code and see if that is also slow. If so at least you will know it is nothing to do with xenforo. Then contact Google (not sure they are much use for tech support, but there is a user forum) but also contact your host who should be able to do some trouble shooting once you can show it is happening on a simple html page.


Thanks for all replies...

Plain html. No problems.
Wordpress with standard theme on same server, no problems (dont think this is server side but...)
Xenforo 1.5 same server, actually some problems on Google insight. But the forum loads just fine, no complains there
Took a random site with Adsense from the "Forum showcase" forum, same problem. Google insight shows high load time.

btw, check your own forum here: https://developers.google.com/speed/pagespeed/insights/ -->
https://cafesaxophone.com/, same problem.

Maybe it's a Google insight problem, not Adsense or Xenforo. Cafesaxophone loads fine for me.


Well-known member
There is no question about it: AdSense will increase page load times and there's is not much you can do about it. On each page load, tour forum has to contact a third party site to furnish the ads.

Options are to add part of the code into the header and the rest into the footer. That will help but the ads will still slow down your pages.

Your best bet is to get the best and fastest hosting you can and work on other ways to streamline the forum.

And switching to another revenue system (like Amazon) is unlikely to help unless the ads are served directly from your own site with links to the advertiser.


Well-known member
One difference between Xenforo 2 and Xenforo 2.1 is the use of Font Awesome 5.6.
Formerly Font Awesome was on a CDN and is now hosted locally.
Seems like little, but it's something else to add in loading time.


Well-known member
@Chris D, have you thought about applying any of these tricks or any other system to reduce the size of Font Awesome?
Would that be possible? Any load time savings would be good for those who have slow hosting servers.

Chris D

XenForo developer
Staff member
We cannot host Font Awesome Pro from a CDN because of the licensing complexities. We would need to input a list of domains which are allowed to use the CDN on our Font Awesome license - that's not even remotely workable.

We could just not provide Font Awesome Pro but then we would be reducing the amount of available icons down from 5,000 to 1,500.

We could provide a much smaller subset using the approach in that link, but the extent of it would be the icons that we only include in the official style and add-ons -- you would all lose access to any icons we don't use in the default software.

Any optimisations would have to come from you and be tailored for your own site. For example, you could reduce the size of your font set so it only includes the icons you need, but you'll likely have to keep doing that as you add more functionality that uses more icons. You could purchase your own Font Awesome Pro license which would allow you to use the CDN.

Frankly though, we're talking micro-optimisations here, at best. Once it is downloaded, it is heavily cached by the browser.

I also have no idea what it has to do with the topic of this thread which seems to be exclusively about latency caused by Adsense ads.


Well-known member
For example, you could reduce the size of your font set so it only includes the icons you need, but you'll likely have to keep doing that as you add more functionality that uses more icons.
I tried this on my forum - reductions in font sizes were quite big but I broke stuff as web development isn't my forte LOL https://community.centminmod.com/threads/forum-style-optimisation-tweaks.16403/
  • woff2 font dropped from 76KB to 19.5KB and the bundled uncompressed css dropped from 31KB to 12KB.
  • woff font dropped from 96KB to 42KB
  • ttf font dropped from 162KB to 42KB
  • eot font dropped from 162KB to 42KB
  • otf front increased from 132KB to 157KB ??
  • svg font dropped from 434KB to 153KB


No that wouldnt help...

We had another issue that made our forum slow. Weird is, now it's fast but insight still shows slow load. So it's either a xf or insight problem this together with adsense.


Well-known member
Weird is, now it's fast but insight still shows slow load. So it's either a xf or insight problem this together with adsense.
Can immediately see a few problems from webpagetest output https://www.webpagetest.org/result/...68b47db6fed72/2/details/#waterfall_view_step1

1. non-optimal HTTPS configuration by using HTTP/1.1 instead of HTTP/2 - this is a web server configuration issue
2. the xf theme you're using isn't optimized for page speed - using a xf theme more optimized for page load speed helps alot if you aren't well versed in web dev side of things
3. xf2 out of the box is a bit behind in terms of page render speed compared to xf 1.5 without further optimisations

Google PageSpeed Insights v5 is heavily weighted towards interactive and speedindex and first contentful paint metrics on 3G moto g4/nexus 5 device emulation. So for dynamic and javascript heavy sites, 3G mobile score or heavily render blocked asset based sites, the score will be lower. From v5 API this is the weighting used to determine the score
  • interactive 5
  • speed-index 4
  • first-contentful-paint 3
  • first-cpu-idle 2
  • first-meaningful-paint 1
So yes more javascript you have, the lower the Google PageSpeed insight scores.

You really shouldn’t look at the overall scores but the metric’s values measured over time to get your relative page speed. Field data origin summary would be that over time measurement rather than the lab data scores which is what the score rating is measured from.

My write up on PageSpeed Insights v5 update at https://community.centminmod.com/threads/google-pagespeed-insights-v5-update.16016/

For pagespeed tests, also use webpagetest.org for pagespeed testing - my guide at https://community.centminmod.com/th...getest-org-for-page-load-speed-testing.13859/