How To Add DNS Prefetch In WordPress (including list of domains)

How To Add DNS Prefetch In WordPress (including list of domains)

DNS prefetch is an easy way to make your WordPress site faster by establishing an early connection to third-party domains.

To add DNS prefetch to WordPress, add this code to your header:


Here are a few other third-party domains you can prefetch:

 
 
 
 
 

WP Rocket, Perfmatters, Pre* Party Resources Hints, and most cache plugins have an option to prefetch DNS requests.

View your PageSpeed Insights or GTmetrix report and view which third-party domains are loaded on your site. Once you find these, copy/paste them into your list of prefetched domains.

Prefetch DNS Requests - PageSpeed Insights

DNS Prefetch In WP Rocket – in WP Rocket, prefetch DNS requests is in the Preload tab.

Prefetch DNS Requests in WP Rocket

DNS Prefetch In Perfmatters – in Perfmatters, prefetch DNS requests is in Extras > Preloading.

DNS Prefetch - Perfmatters

Complete list – for a more complete list, see Luke’s list of common domains to prefetch on Github (I added a few others). If I missed any common ones, leave me a comment and I’ll add it.

//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
//api.pinterest.com
//cdnjs.cloudflare.com
//domain.kinstacdn.com
//pixel.wp.com
//connect.facebook.net
//platform.twitter.com
//syndication.twitter.com
//platform.instagram.com
//disqus.com
//sitename.disqus.com
//s7.addthis.com
//platform.linkedin.com
//w.sharethis.com
//s0.wp.com
//s1.wp.com
//s2.wp.com
//s.gravatar.com
//0.gravatar.com
//2.gravatar.com
//1.gravatar.com
//stats.wp.com
//www.googletagmanager.com
//www.googletagservices.com
//adservice.google.com
//pagead2.googlesyndication.com
//tpc.googlesyndication.com
//securepubads.g.doubleclick.net
//bp.blogspot.com
//1.bp.blogspot.com
//2.bp.blogspot.com
//3.bp.blogspot.com
//4.bp.blogspot.com
//ajax.microsoft.com
//ajax.aspnetcdn.com
//s3.amazonaws.com
//a.opmnstr.com
//script.hotjar.com
//i.ytimg.com
//code.jquery.com
//stackpath.bootstrapcdn.com
//use.fontawesome.com
//player.vimeo.com
//github.githubassets.com
//referrer.disqus.com
//c.disquscdn.com
//0.gravatar.com
//2.gravatar.com
//1.gravatar.com
//ad.doubleclick.net
//googleads.g.doubleclick.net
//stats.g.doubleclick.net
//cm.g.doubleclick.net
//stats.buysellads.com
//s3.buysellads.com

Don’t

[…]

 



This article was written by Tom Dupuis and originally published on Tom Dupuis.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

You have to agree to the comment policy.

Scroll to Top