Search This Blog

AddThis or how to make sharing easy!

posted on Thursday, March 1, 2012

Last week I was asked to implement some sharing options very last minute. Since Google is my friend, I checked with him first and he happened to come up with something awesome: AddThis!

How long did it take you to figure out that it's an image, not the real thing? ;)

AddThis is a collection of code blocks and API's to integrate sharing options onto your platform. This platform could be a plain old website, a Blogger, WordPress, Joomla, Drupal, ... but it can also be used for Flash, Android SDK or Email Newsletters.

I got the plain old website version which is the simplest implementation: you just add a piece of HTML code with a JavaScript reference to your site and you're ready to go. Literally, implementing the website-version will take you only five minutes.

The code underneath is the default code to add AddThis to a website (yeps, that's all!).
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style" style="margin-top:8px; margin-left:8px;">
 <a class="addthis_button_facebook"></a>
 <a class="addthis_button_twitter"></a>
 <a class="addthis_button_linkedin"></a>
 <a class="addthis_button_google_plusone"></a>
 <a class="addthis_button_email"></a>
 <a class="addthis_button_print"></a>
 <a class="addthis_button_favorites"></a>
 <a class="addthis_button_compact"></a>
<script type="text/javascript" src=""></script>
<!-- AddThis Button END -->

A great feature is the number of supported sharing options such as Facebook, Twitter, LinkedIn, Google+, e-mail, bookmarks and a whole lot more. Since you can just get the code, you're free to customize it as you like.

But wait, there's more! 
Generally, AddThis uses the URL of the current page and shares this to the selected sharing option. But in my case, the current page URL was not the URL I wanted to share. Luckily, it's easy to change the shared URL. All you have to do, is add some extra JavaScript that changes the URL.

// required for the sharing options
$(document).ready(function () {
 addthis.update('share', 'url', '');

That's it, I figured that it could be useful :)

To find out more:

Could be useful, right?

No comments:

Post a Comment