Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense prefetch

Adsense loading speed

         

dolcevita

9:23 am on Mar 14, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I found a blog where the author claims a little in practice implemented method to get Adsense loading speed.

Namely, he claims "the mean page-load-time (including ad-loads) fell 402 milliseconds on mobile devices. It also fell 360ms on other device categories."!

It also explains why we don't use prefetch (it improves performance even more than preconnecting. However, that approach might interfere with the request order and cookies that AdSense requires to fulfill an ad request.) but only preconnect.

I wonder if anyone has implemented this method below and what was their experience?


<link rel="preconnect"
href="https://adservice.google.com/" crossorigin="anonymous">
<link rel="preconnect"
href="https://googleads.g.doubleclick.net/" crossorigin="anonymous">
<link rel="preconnect"
href="https://www.googletagservices.com/" crossorigin="anonymous">
<link rel="preconnect"
href="https://tpc.googlesyndication.com/" crossorigin="anonymous">

dolcevita

1:49 pm on Mar 14, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I set it up and I don't notice much of a difference because it's still 360ms - 402ms, but every load acceleration is worth it.

rajdeep

1:56 pm on Mar 16, 2023 (gmt 0)



I'm using dns prefetch and it has been 3y. I observed it helps to load ads faster when you have cache enabled. PS- using on WP site with LScache plugin.

Here's my prefetch URLs

<link rel='dns-prefetch' href='//fonts.gstatic.com' /><link rel='dns-prefetch' href='//b.scorecardresearch.com' /><link rel='dns-prefetch' href='//securepubads.g.doubleclick.net' /><link rel='dns-prefetch' href='//pubads.g.doubleclick.net' /><link rel='dns-prefetch' href='//www.google-analytics.com' /><link rel='dns-prefetch' href='//www.googletagservices.com' /><link rel='dns-prefetch' href='//tpc.googlesyndication.com' /><link rel='dns-prefetch' href='//fonts.googleapis.com' /><link rel='dns-prefetch' href='//ajax.googleapis.com' /><link rel='dns-prefetch' href='//www.google.com' /><link rel='dns-prefetch' href='//googleads.g.doubleclick.net' /><link rel='dns-prefetch' href='//sb.scorecardresearch.com' /><link rel='dns-prefetch' href='//pagead2.googlesyndication.com' /><link rel='dns-prefetch' href='//www.googletagmanager.com' /><link rel='dns-prefetch' href='//cse.google.com' /><link rel='dns-prefetch' href='//connect.facebook.net' /><link rel='dns-prefetch' href='//www.googleadservices.com' /><link rel='dns-prefetch' href='//adservice.google.co.in' /><link rel='dns-prefetch' href='//protagcdn.com' />

csdude55

5:50 pm on Jul 18, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I just now came across this, and I'll implement it tonight to see what happens. When we're talking about shaving off milliseconds I'm not sure if I could accurately test it, but like @dolcevita said, any load acceleration is worth it!

@rajdeep, while I was researching I came across this article that describes the difference between dns-prefetch and preconnect:

[nitropack.io...]

It says that preconnect does everything that dns-prefetch does, but also handles TLS negotiations and TCP handshakes. But some browsers don't recognize preconnect, so their recommendation was to double down and do both with preconnect first; eg,

<link rel='preconnect' href='//fonts.gstatic.com' crossorigin='anonymous' />
<link rel='dns-prefetch' href='//fonts.gstatic.com' crossorigin='anonymous' />


I'm not 100% sure that I understand the crossorigin='anonymous' usage. Some resources say that if you're fetching something from a different domain then you should use it, but others say that if the request is done via <img>, <style type=stylesheet>, <iframe>, or <script> and doesn't include crossorigin then the fetch shouldn't, either. Those two are completely contradictory, so I hope someone can explain that one better!

Also, mozilla.org says that the default for "crossorigin" is "anonymous", so you could leave off "='anonymous'" for brevity:
[developer.mozilla.org...]

CommandDork

11:36 am on Jul 23, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Since implementing this a few days ago, I've started to see a "www. gstatic .com" domain show up in my sites list on Adsense delivering just a handful of pageviews and impressions. Is that normal?

A web search says that this is a google-owned domain used to load content faster from their servers. I DO use one of their fonts so I'm guessing it's that.