Disconnected ShareThis plugin for WordPress

I see the ShareThis plugin on tons of WordPress blogs — and with reason, because the presentation is quite nice. You don’t have to take up a chunk of the screen listing all of the different social networks (and they keep multiplying…) or offering the option to email this post to a friend; instead you have a simple link that shows all of the useful detail in a little popup.

ShareThis was so popular, in fact, that a business has sprouted up around it — and current versions of the plugin are tightly bound into the ShareThis.com website. They collect data every time anyone even clicks the link to open the ShareThis window, the social networks links all redirect through the ShareThis.com servers, and all that data (associated with your website) is there for detailed reporting if you register with them. They now also encourage your visitors to sign up. I’m sure it has its uses, and they’re supported by advertising revenue, so they want lots of people to sign up and I imagine they use all that data in conjunction with showing those ads.

Note: I haven’t registered, so I don’t know where the ads come into it… I just read their terms privacy policy where they mention advertising revenue, and using your data. For example:

…by posting or submitting content or materials on public areas of the service, such as public message boards, etc., you are giving us permission to use your submission in connection with the operation of ShareThis, including the right to copy, transmit, publicly display and reformat your submissions on ShareThis.

And “ShareThis is supported by advertising revenue. Some of the advertisements may be targeted.” Etc..

Unfortunately, the tracking features slow down the process (there’s a delay while it opens the window, visitors have to wait for the redirects, etc.)… but more importantly, they creep me out (I want control of my data!), and you can’t turn them off even if you aren’t interested in all the related features. Each time someone clicks the icon, forwards an email, submits a link, etc. there’s a step in there that goes through r.sharethis.com, and it’s all tracked and associated with your blog.

You can still download older versions (since before all of the tracking features were added) from here… but then you’re missing out on bug fixes.

My personal solution was to download the “ShareThis Classic” plugin from the website of Alex King (the original creator) — since it includes bugfixes and is the last version before the entire ShareThis popup started to be loaded directly from ShareThis.com. It does include the tracking features, but it’s pretty easy to disable them if you know at least minimal PHP:

  • First, make sure you have a backup of the zip file (to reinstall if needed)
  • Visit the Plugins page in wp-admin
  • Make sure ShareThis Classic is deactivated (click Deactivate if not)
  • Click Edit
  • Search the page for references to “r.sharethis.com”
  • Update the code to remove the redirects and links (more details below)
  • Click “Update File”, reactive the plugin, and make sure you haven’t broken anything!

Example changes:

Remove the redirect from a link:

return 'http://r.sharethis.com/web?destination=' + encodeURIComponent(base) + '&publisher=' + pubid;

CHANGE TO:

return base;

Remove the image (which identifies you when it’s loaded)…

<img src="http://r.sharethis.com/powered-by?publisher=<?php print(get_option('st_pubid')); ?>" alt="Powered by ShareThis" />

CHANGE TO:

Powered by ShareThis

Remove the reporting of an email submission:

require_once(ABSPATH.WPINC.'/class-snoopy.php');
$snoop = new Snoopy;
$snoop->agent = 'ShareThis Classic for WordPress';
$snoop->fetch('http://r.sharethis.com/email?url='.urlencode(get_permalink($post_id)).'&publisher='.get_option('st_pubid'));

[Just remove those lines.]

…and remove another redirect:

print('                <li><a href="http://r.sharethis.com/web?destination='.urlencode($link).'&publisher='.get_option('st_pubid').'" id="akst_'.$key.'">'.$data['name'].'</a></li>'."\n");

CHANGE TO:

print('                <li><a href="'.$link.'" id="akst_'.$key.'">'.$data['name'].'</a></li>'."\n");

That one’s a bit ugly….

Might as well fix a bug while we’re here…

If you use any version of ShareThis Classic, there’s a bug in sharing via email: it returns a page with “WordPress Error” as the title (though the sending actually worked), and in the current version of ShareThis Classic the link back to the post is broken.

To fix these bugs find this code:

wp_die(__('Thanks, we\'ve sent this article to your recipients via e-mail. <a href="'.get_permalink($post_id).'">Return to original page</a>.', 'share-this'));

CHANGE TO:

wp_die(__('Thanks, we\'ve sent this article to your recipients via e-mail.', 'share-this').' <a href="'.get_permalink($post_id).'">'.__('Return to original page', 'share-this').'</a>.', 'Article shared successfully!');

Is it legal to make these changes?

Short answer: Yes.

Longer answer: The PHP code is licensed under the open source GPL (GNU Public License). That means you can edit it however you like, and you can even redistribute your changed source code — though I’m not redistributing the whole plugin right now, since it’s trivial to make these changes yourself, and I haven’t looked up the licensing for that ShareThis image.

I also notice that the terms in ShareThis.com include a lot of restrictions that are NOT allowed by the GPL, even though the PHP itself is still licensed that way — they make claims like this:

You may not reverse engineer, decompile, or disassemble any aspect of ShareThis Widgets. You may not modify, adapt, or create derivative works from the ShareThis Widgets. Do not remove proprietary notices. Do not help any one else to do any of the things prohibited in this paragraph.

…which, frankly, are nonsense, assuming “ShareThis Widgets” comprise the PHP plugin… and what other code would they mean? Huh. Anyway — GPL. Go read it if you aren’t sure (perhaps the ShareThis lawyers ought to read it… it’s in the header of the PHP file).

21 Comments

  1. Reply
    James B 20th February, 2008

    I have to disagree with your post. Sure, ShareThis might be tracking this data, but I love seeing the reports they generate. As a publisher and site owner, it is very important to understand where my content is going and what is being shared. If my visitors want to sign up for their free service, then even better because it will make their experience on my site better. I do agree though that the box loads a little slower, but I’m sure they are working on improving that. And, Sharethis should be the least of your worries. You might want to start worrying about Google and how deep they are getting into sites and users’ profiles.

  2. Reply
    rob 20th February, 2008

    @James B: Sure, ShareThis is certainly not the *most* of my worries. I also run my own mailserver, and don’t use Google Apps, for example.

    But I also get the sense that people don’t understand the possible repercussions of letting companies all over the web gather and share their information. Yes, giving them this information enables services that are valuable — and the ShareThis reports are a good example of that — but they are not “free”.

    I’ve read a lot of accounts recently about women who change their “single” status to “engaged” on Facebook… and are immediately flooded with ads for wedding-related services (even if that’s the *last* thing they want to see..). One woman in this situation was aghast, and set her status back to “single” to try to avoid the ads… only to have her friends and family suddenly concerned that the engagement was off. It’s messy.

    ShareThis is on a much smaller scale, though I don’t know who they will partner with along the way, and what information they will share now or in the future with paying advertisers. Notice how the terms of service on their website (like many, many places) stipulates that the terms may change at any time without notice. Why do that? I run an online business — my privacy terms are clear, and I specifically say I’ll contact users and give them the chance to opt out if the privacy terms are going to change. It’s not hard.

    But it’s not the end of the world, either way — if you know the price you’re paying (however vague that price may be) and it’s worth the service you’re getting, then good. If you don’t think it’s worth it (this is where I am) then I at least want the ability to opt out.

    This post was about making it easy to opt out for those who want to.

  3. Reply
    AhmedF 9th April, 2008

    Rob – you should try out our iBegin Share tool (linked as my name). Fully open source, and comes with printing/pdf/Word doc support.

  4. Reply
    Seppo 17th May, 2008

    Checked iBegin Share, and it looks quite nice. As far as I understand, it will not send information to any third party, and it logs only the pages that are being shared, but not any personal information (except IP address). Is that correct? It also is possible to translate it. And it is open source. 🙂

  5. Reply
    Joseph Kulandai 23rd May, 2008

    Excellent post! Thanks!!

  6. Reply
    Joseph Kulandai 24th May, 2008

    Hi, I have customized and used this plugin and working well. Thanks!

    After a mail is sent, the page gets forwarded to an error page! Its the same way happening in your site also. See the title of the page.

    Can you please share the idea to fix that?

  7. Reply
    Seppo 26th May, 2008

    I had similar experience, the customized plugin worked fine except the error page.
    I changed to iBegin Share, but it has problems with character encoding, so I would get back to Rob’s nice customized Share plugin, if there is a fix for that error message problem.

  8. Reply
    Nikon 6th November, 2008

    Thank you very much for infu. The author RESPECT and uvazhuha.

  9. Reply
    rob 14th December, 2008

    I checked into the error page problem and fixed it.

    The bug is shared by all versions of ShareThis Classic — the plugin uses “wp_die()” as a way to return a status message to the user. It’s not intended to be used that way, but I also didn’t want to rewrite big chunks of the plugin to fix the bug.

    Fortunately, wp_die() takes an optional “title” parameter, so it was a simple fix. I also fixed a bug I noticed in the current release of ShareThis Classic (a typo breaks the link back to the post).

    To fix the bugs (this change is also added to the post above):
    Search the plugin for this text:
    wp_die(__('Thanks

    Then replace that line of code with this:
    wp_die(__('Thanks, we\'ve sent this article to your recipients via e-mail.', 'share-this').' <a href="'.get_permalink($post_id).'">'.__('Return to original page', 'share-this').'</a>.', 'Article shared successfully!');

    Cheers,
    Rob

  10. Reply
    Crystal Signature 2nd May, 2009

    Hello, I just want to completely remove the Sharethis widget but it seems something is preventing me to do that!!!

    Firstly I deactivated the plugin, I still see the it’s icons be tailed on every post; then I went to the directory to delete the whole folder, the weird thing is those icons still appear!!! How come!

    Can anyone tell me how to “completely” remove the plugin? Thanks.

    For example if open this post then you will see at the bottom of the post there are two icons which used to belong to the ShareThis and should not appear here since I’ve already removed ShareThis.

    http://www.crystalsignature.com/2009/04/bangle-bracelet-step-by-step1/#more-160

  11. Reply
    Crystal Signature 2nd May, 2009

    Now I would say this plugin is just a evil, once you installed it, you can’t normally get rid of it. All my post/page now are infected with this evil, I have physically went into the server and deleted the plugin’s folder, why those icons still appear at the bottom of my post/page? Can anyone help? Pleassssssssssssssssssss.

    • Reply
      rob 2nd May, 2009

      @Crystal: those icons are showing up because of a DIFFERENT sharing plugin, called “Sociable”.
      Delete that one if you don’t want to see the icons anymore.

  12. Reply
    Kaffeevollautomaten 1st November, 2009

    thanks, your article is very informative.

  13. Reply
    Anaedaytund 2nd January, 2010

    Amazing .. very cool matter. I will write about it as well!

  14. Reply
    Kitty Love 7th February, 2010

    Great information is very interesting. I’m Kitty and learning SEO from New York.

  15. Reply
    Berhard 9th February, 2010

    nice wordpress theme – where can i get it? or it is selfmade?

    • Reply
      rob 10th February, 2010

      Hello! The current theme is based on the (kinda out of date by now) Fauna theme, with various plugins added and some minor tweaks.

  16. Reply
    Sharon Stevens 15th February, 2010

    I keep looking for new plugins all the time for my website & have seen a lot of wordpress sites use ShareThis plugin, its been very popular.

  17. Reply
    Penny auctions 10th June, 2010

    thanks a lot for sharing this plugin and information man…

  18. Reply
    zquiet 20th June, 2013

    This page definitely has all the information I
    needed about this subject and didn’t know who to ask.

  19. Reply

    I was suggested this blog by my cousin. I’m no longer sure whether or not this publish is written via him as no one else understand such unique about my problem. You’re wonderful!
    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.