3PO

June 27th, 2012. Tagged: performance, yslow

Say hello to the 3PO extension for YSlow. It checks your site for integration with popular 3rd parties, such as Facebook, Twitter widgets, Google Analytics and so on.

3PO (3rd party optimization) extension currently has 5 checks: two of them generic to all 3rd parties and three specific to Facebook plugins. I'm looking forward to adding more checks and more specific to a particular provider's best practices.

The extension is currently available as a bookmarklet, but since YSlow is a platform available on many platforms, it can be built as a Firefox or Chrome extension, command line tool, etc.

Install

Click this link to test, or drag to your bookmarks to install

YSlow +3PO

And the code is available in my YSlow fork on Github.

Checks

Here's a the list of checks along with some explanation.

Load 3rd party JS asyncrhonously

Category: Common

Use the JavaScript snippets that load the JS files asynchronously in order to speed up the user experience. Most providers offer you an asynchronous version of the script you're including on your page. If they don't, let them know and meanwhile do it yourself

If you don't include the script asynchronously, you create a SPOF (Single Point of Failure) and your site effectively goes down when the 3rd party goes down. See for yourself.

Load the 3rd party JS only once

Category: Common

Loading the 3rd party JS files more than once per page is not necessary and slows down the user experience. Sometimes people copy-paste snippets multiple times on the page, e.g. when you have one widget per blog post in a blog post listing. The script only needs to load once and serve multiple widgets.

Define XML namespace

Category: Facebook

If you use tags like <fb:like> you need to define an XML namespace to make the plugin work in old IE versions. Same for any tag that has :

Add an #fb-root element

Category: Facebook

The Facebook JS SDK needs an element with id="fb-root". So add this to your page, before you include the Facebook JS SDK

<div id="fb-root">

Include OG (Open Graph) meta tags

Category: Facebook

Open graph tags let you better describe your content. To learn more, see the documentation. And run the tool to validate your page.

Tell your friends about this post: Facebook, Twitter, Google+

Sorry, comments disabled and hidden due to excessive spam. Working on restoring the existing comments...

Meanwhile, hit me up on twitter @stoyanstefanov