The past several weeks haven’t been kind to Facebook. Its long-anticipated IPO was nothing short of a disaster, and since its public debut, the company’s stock has been battered.

Clearly, finding investor friends on Wall Street hasn’t been an easy task for the world’s largest social network, and it may discover that finding retail friends on Main Street won’t be any easier after site outages last week left some ecommerce sites in a lurch.

According to website monitoring and analytics provider Catchpoint, the websites of numerous high-profile retailers, including Urban Outfitters, L.L. Bean, HSN, J.C. Penney, Teleflora, and 1-800-Flowers, saw poor performance as their pages slowed due to inline JavaScript code that was unsuccessfully trying to load content from Facebook.

Catchpoint explained:

The issue affected mostly web sites that have placed the Facebook code inline in their page.  From an end-user perspective the “spinning hourglass” never stopped while loading the web page because the browser waited and waited and waited for resources to www.facebook.com to complete which they never did. Worst case scenario users might have seen pages hanging or functionality of the page was impaired. A few websites, their developers followed WPO techniques and loaded the Facebook tags asynchronously, not blocking their content and their users did not even notice the issue. Sadly very few websites implement such techniques for third-party tags. To have a widespread adoption of such techniques, the vendors should be the ones implementing them on the tags they provide to the sites.

Best practices around the use of external JavaScript are well-established, even if they’re not well-followed. And the fact that there’s a lot not to like about Facebook’s ‘Like’ button in particular shouldn’t come as news to retailers using it. Yet the number of major retailers using the ‘Like’ button and implementing it in the worst (read: most inefficient and risky way possible) evidences the fact that a lot of retailers just don’t get JavaScript.

The cost of this is hard to put an exact figure on, but one thing is for sure: it’s potentially huge. For many publishers, a page that loads slowly (or doesn’t load at all) may not be a big deal. It’s a temporary and soon-forgotten annoyance to the consumer and has a direct cost measured in pennies. But for retailers, a poorly performing page can lead to a cart filled with products to be abandoned, and it can drive potential customers into a competitor’s arms.

While last week’s Facebook outage didn’t mean the end of the internet as we knew it, for affected retailers, it provided a worthwhile reminder: if you’re going to ‘Like’ external JavaScript, liking best practices is a good way to make sure the relationship is a stable one.