ShareThis Slowing Down Your Site? Here’s Why.

I’ve never been a fan of ShareThis. It’s caused nothing but headaches and slow load times on sites I’ve installed it on. I had always assumed it was because they had slow servers, but until recently, never really dug into it. If you’re having problems with ShareThis slowing down you site, read below. I was pretty surprised to find out what was really going on.

I cringe every time I hear someone mention ShareThis. When optimizing a site, it becomes a nightmare to speed up; a paranoids worst fear with all the third-party calls it makes — and a blackhole for sercuity experts tracking down the seemingly ever-changing external scripts it loads.


ShareThis Third-Party Resources

In the process of implementing a CSP, I was shocked to find the total number of resources ShareThis calls. At the time of writing this, I counted a total of 39 domains and subdomains it the ShareThis plugin was calling:

  1. http://w.sharethis.com (JavaScript, Image)
  2. http://wd-edge.sharethis.com (JavaScript)
  3. http://wd.sharethis.com (JavaScript)
  4. http://w.sharethis.com (CSS)
  5. http://l.sharethis.com (Image)
  6. http://adadvisor.net (Image)
  7. http://bcp.crwdcntrl.net (Image)
  8. http://rc.rlcdn.com (JavaScript)
  9. http://d.agkn.com (JavaScript)
  10. http://secure-us.imrworldwide.com (JavaScript)
  11. http://log.dmtry.com (JavaScript)
  12. http://match.adsrvr.org (JavaScript)
  13. http://www.wtp101.com (JavaScript)
  14. http://www.adadvisor.net (Image)
  15. http://p.brilig.com (Image)
  16. http://e.nexac.com (Image)
  17. http://su.addthis.com (Image)
  18. http://rtd.tubemogul.com (Image)
  19. http://d.p-td.com (Image)
  20. http://ds.reson8.com (Image)
  21. http://loadus.exelator.com (Image)
  22. http://dp2.33across.com (Image)
  23. http://p.nexac.com (Image)
  24. http://p.raasnet.com (Image)
  25. http://p.rfihub.com (Image)
  26. http://i.w55c.net (Image)
  27. http://loadm.exelator.com (Image)
  28. http://a.triggit.com (Image)
  29. http://sync.mathtag.com (Image)
  30. http://r.casalemedia.com (Image)
  31. http://dpm.demdex.net (Image)
  32. http://idsync.rlcdn.com (Image)
  33. http://load.s3.amazonaws.com (Image)
  34. http://d.xp1.ru4.com (Image)
  35. http://segments.adap.tv (Image)
  36. http://dm.de.mookie1.com (Image)
  37. http://ib.adnxs.com (Image)
  38. http://tags.bluekai.com (Image)
  39. http://sync.tidaltv.com (Image)

Nuts, huh?! Not a big surprise anymore why ShareThis was causing my slow page load times. From what I found, the majority of the calls are for ad and user habit tracking pixels. No wonder their a free service, their probably getting paid big bucks from companies to track what you’re doing. Though, I understand they need to connect to the various social network APIs to grab numbers, I don’t think they need to add tracking pixels for advertisements and user habits.

An example is adadvisor.net and crwdcntrl.net. Their domains used by Targus Info and Lotame which is an advertising company that is part of a network of sites, cookies, and other technologies used to track you, what you do and what you click on, as you go from site to site, surfing the Web. Over time, sites like adadvisor.net and crwdcntrl.net can help make an online profile of you usually including the sites you visit, your searches, purchases, and other behavior. Your profile can then be exchanged and sold between various companies as well as being sold to other advertisers and marketers.


Alternatives to ShareThis

After finding out everything ShareThis is doing, it was time to find some alternatives. Here’s some I’ve found that seem to be less resource intensive—though may still load ad and user habit tracking pixels, not nearly as many as ShareThis:

WordPress Plugins

If you prefer a more plug-and-play options, here’s some pretty good WordPress plugins and Drupal modules for social sharing.

1. Flare

Flare is a simple yet eye-catching social sharing bar that gets you followed and lets your content get shared via posts, pages, and media types.

Flare

2. Social Count Plus

Display the counting data of Twitter, Facebook, YouTube, Instagram, Steam Community, SoundCloud posts and comments.

Social Count Plus

3. Dig Dig

Your all in one share buttons plugin. Add a floating bar with share buttons to your blog. Just like Mashable!

Dig Dig

4. AddThis

AddThis Share Buttons help drive traffic to your site by helping visitors share, bookmark and email your content to over 330 services.

AddThis

5. Shareaholic

Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.

Shareaholic

Drupal Modules

1. Social media

The social media module helps integrate your website with social media sites such as Twitter, Facebook and Google+. It provides an centralized way of managing social media profile information and plug-in widgets such as follow and share buttons.

Social Media

2. Easy Social

Centered in a single place, you don’t need to worry in including external javascript libraries, and enabling several social modules.

Easy Social

3. AddToAny

This module helpers your readers and subscribers share, email and bookmark your articles and pages using the popular services such as Facebook, Twitter, Pinterest and over 100 more.

AddToAny

4. AddThis

This is the #1 bookmarking and sharing button on the net. Simple and easy to use button that’s used by 14 million websites worldwide and reaching 1.3 billion people worldwide per month.

AddThis

5. Service links

Service Links facilitates the adding of social networks links or javascript buttons within the content with a special focus on developers and themers interested to extend their number or customize their displaying. Built on Drupal for Drupal doesn’t include commercial advertising or spying hidden code and doesn’t require third part libraries.

Service links

How to Create a Patch for a Drupal Module

I recently downloaded the Drupal Security Kit module to implement a Content Security Policy on a site I’m working on. One of the drawbacks was the 128 character limit it has for the allowed source fields. That was a bit too restrictive for my needs due to the number of external scripts the site uses. The solution, create a patch for a Drupal module.

I recently downloaded the Drupal Security Kit module to implement a Content Security Policy on a site I’m working on. One of the drawbacks was the 128 character limit it has for the allowed source fields. That was a bit too restrictive for my needs due to the number of external scripts the site uses. The solution, create a patch for a Drupal module.

If you’re not familiar with what a CSP is, I recommend looking into adding one to increase your sites’ security. Mike West wrote a great introduction to CSPs.

After digging around for awhile trying to figure out how to create a patch for a Drupal module, most of the posts I found assumed that you already had a pretty good understanding of Drupal. Being fairly new to Drupal myself, this was a bit of a pain to figure out—a common theme I’ve found with all Drupal development. With some help from a fellow Drupal developer, after about 15 minutes, I got it figured out and submitted my first patch to Drupal.org (currently pending review).

In my experience, I’ve found documentation for Drupal development is a bit scarce and when you do find some, it’s usually written for Drupal veterans. So, I thought it would be a good idea to share my experience with others like me how are just getting started with the CMS.


Creating a Patch for a Drupal Module

For this post, I’m going to use the Security Kit module as an example. If you’re not familiar with what a patch is, check out Drupal’s patch page. Basically, patches are pieces of code that solve an existing issue. Once a patch has been applied, the issue should no longer exist.

Step 1: Clone the Drupal Module

The first step is cloning the module. If you don’t already have Git installed, you’re going to need to install it. Once you have, head over to the module’s project page (ex. https://drupal.org/project/seckit).

Security Kit
https://drupal.org/project/seckit

Click “Version Control” under the title (ex. https://drupal.org/project/seckit/git-instructions). Where it says, “Version to work from”, select the version of the module you’re wanting to patch. In this case, I want to patch 7.x-1.8, so selected “7.x-1.x” and then clicked “Show”.

Drupal Module Version

Now open up a terminal window with Git installed and clone the project’s repo. In this example:

This will copy the project’s files onto your system so you can make the updates needed.

Step 2: Update the Module

Since I needed to increase the maxlength limit for the allowed source fields, I opened: sites/all/modules/contrib/seckit/includes/seckit.form.inc which includes the admin form settings for that module’s configuration page. There I found that they weren’t defining the maxlength for the fields, so defaulted to the 128 character limit.

This is easily fixed by adding the #maxlength option to the fields array. See the example below:

For more information on how Drupal handles form fields, see their Form API Reference docs.

Step 3: Create the Patch

Now that you’ve made the changes to the module, you’ll need to create the patch for it. This is easily accomplished with Git. Open terminal and go into the module’s directory:

With this being a simple update, the following command will work for most improvements:

In my case, there hadn’t been an issue created for my problem yet, so I did:

For more complex improvements that require adding/removing files, work over the course of multiple days including Git commits, or collaboration with others, see the Advanced patch workflow.

This will create the patch file you need in the module’s directory. Pretty simple, huh? So, what about applying a patch?

Appyling a Patch to a Drupal Module

Applying a patch is as simple as adding the patch file to your module’s directory, then running the following command:

In my case, I did:

Once the patch has been applied, be sure to remove it so it doesn’t accidentally get included in future commits:

Pretty simple stuff!


I’d love to hear any feedback, suggestions or questions. Keep in mind, I’m fairly new to Drupal so would love to hear what the veterans think.