Our Custom AddThis Code to use Bitly, Custom Title and Disable Cookies

There are many options and configurations the AddThis code could have for your setup. We needed the following settings:

  • Twitter username, to offer the option to people to follow AmityWeb when they Tweet our pages
  • Bitly to shorten any URLs, when using Twitter
  • Disable AddThis cookies for the EU Cookie Law
  • Custom Title setup for Twitter (page Title, then the URL link)

Here's our code…

<div class="addthis_toolbox addthis_default_style">
    <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
    <a class="addthis_button_tweet" tw_via="TWITTER_USERNAME"></a>
    <a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
    <a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">
    var addthis_config = {data_use_cookies:false}
    var addthis_share = {
        url_transforms: {
             shorten: {
                 twitter: 'bitly'
             },
         },
         shorteners: {
             bitly: {
                  login: 'BITLY_USERNAME',
                  apiKey: 'BITLY_KEY'
             }
         },
         templates : {
         twitter : "{{title}} {{url}}"
    }
}
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ADD_THIS_USERNAME"></script>

If you want a custom image to show on the post (e.g. on the Facebook page) then you should put this in the HEAD section of the page:

<link rel="image_src" href="path-to-image.jpg" />