WordPress: Use Google Libraries instead of locally hosted ones

Martin Brinkmann
Oct 15, 2013
Updated • Oct 15, 2013

As I pointed out numerous times before: speed is important for any kind of operation on the Internet as a better loading performance will improve conversions on your websites. Mozilla managed to increase Firefox downloads by 60 million per year by shaving off 2.7 seconds of loading times on the organization's download pages.

Many modern themes and websites use JavaScript libraries and components such as jQuery, Prototype or Dojo to power part of their site's functionality.

While that is great in theory for a number of reasons, it means that users have to download those scripts when they connect to the service or website for the first time. There is one exception to the rule: if a script has not been modified and is already in the cache of the browser, it won't get downloaded again but loaded from the local browser cache.

One suggestion that developers had in recent time is to switch to remotely offered scripts instead of locally ones. And one of the prime targets for that is Google, as it is hosting numerous scripts on its fast content distribution network for anyone to use.

Google Libraries

The benefit of using hosted versions of jQuery and other scripts are the following:

  • Improved latency thanks to Google's impressive content distribution network that delivers the scripts from a location close to the user to decrease latency and speed up downloads
  • Parallel downloads thanks to being offered from another server. This is especially important if users are working with browsers that limited simultaneous downloads from web servers to 2 connections.
  • Better caching thanks to an increased likelihood that the script is already cached for users who connect to your website for the first time.

Especially the third option can speed things up for first time visitors, as the scripts do not have to be loaded at all if the user did download them on another web property previously before.

The WordPress plugin Use Google Libraries changes the location of several locally used scripts to Google hosted ones so that you and your site's visitors can benefit from this.

It is an install and forget about it plugin, as it handles everything in the background. There is no configuration to make, and you should check the effectiveness of the plugin by monitoring your website's network activity after plugin installation.

If you are using Chrome or Firefox, hit F12 and select Network from the tabs listing in the Developer menu that opens here. Reload the web page and look at the scripts that get loaded. You should notice that some get loaded from Google servers instead of the local server.

As far as support goes, the plugin for WordPress supports the following libraries and components right now:

  • Dojo
  • jQuery
  • jQuery UI
  • MooTools
  • Prototype
  • script.aculo.us
  • swfobject

If your website is using other scripts, they may still be loaded from the local server and not from the remote server.

One additional benefit from this operation is that you will save bandwidth. Some scripts have a size of 100 Kiloybtes or larger, which you save for every new connection made. If you get 1000 new connections per day, you are saving 100.000 Kilobytes per day, or 36.500.000 Kilobytes per year.

Closing Words

To sum it up: You increase the loading performance of your websites if supported scripts are being used, and at the same time reduce how many bandwidth your website requires.

The only caveat here is that you load resources from Google, which some may see as a privacy risk that they do not want to take.

Now Read: Optimize your website's page loading time


Previous Post: «
Next Post: «


  1. Jake Stapleton said on October 20, 2013 at 6:48 pm

    I am speechless with the enormous difference this made on a WP site that was just painful to use on the admin side. On the forward facing side load times are amazingly faster as well!

  2. Rudd said on October 20, 2013 at 5:17 pm

    Thanks for the recommendation of the plugin. I believe many developers are suggesting the same plugin as well.

  3. Rick said on October 16, 2013 at 9:31 pm

    All seems good until an update to the Google library causes other plugins to break, and then you’re in the soup!

    1. Martin Brinkmann said on October 16, 2013 at 9:45 pm

      They keep all versions available as far as I know.

  4. Karl J. Gephart said on October 15, 2013 at 8:38 pm

    Good advice, Martin! I always use Google scripting for jQuery rather than the local WordPress code since most people will have it cached, making their experience on the site faster.

  5. TheMerricat said on October 15, 2013 at 8:09 pm

    The only concern I would have with doing this is would be the question of whether Google would ‘support’ this or not. You are essentially syphoning part of their bandwidth for your own use. And while your use may not be that much compared to their own daily use, every little bit counts.

    Should they decide to (re)move or alter their libraries to suit their own needs, unless they are actively supporting your use of their copies of the libraries, things could fall apart rapidly for your site. And if you’ve happened to ‘forget’ that you installed this, it could be a pain to troubleshoot where the problem is coming from.

    1. ReX said on October 16, 2013 at 6:09 pm

      Your worries are unfounded to say the least.
      Google encourages you to use their hosted libraries, that’s why they set up the CDN to begin with.


Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.