2

Is there any private social share API?

Requirements are:

  • Available as PHP or JavaScript library
  • Well supported
  • Shares on Facebook, Twitter, Google Plus, Pinterest

What's NOT needed:

  • Heavy-weight scripts which clutter DOM
  • Any intermediate websites involved
  • Support for over 9000 services

Basically, it should just combine native APIs and reflect any changes in them quickly.

As I experienced AddThis, ShareThis, Shareaholic all require too much JavaScript, include many unwanted things in DOM and do all sharing via their servers.

2
  • Found sharrre.com and I am pretty happy with it! It supports sharing on Facebook, Twitter, Google+, Pinterest, LinkedIn, Delicious, Digg, StumbleUpon. Well commented and the JS file weights only 14kb. Also, was updated just 10 days ago. Think, I'll stick with this one for now. – Edward Ruchevits Aug 8 '14 at 2:41
  • 1
    It would be great if you could add this as an answer, highlighting how it matches your requirements and describing your experiences with it so far. – unor Aug 8 '14 at 9:08
1

Currently the best option I found is sharrre.com.


It supports sharing on:

  • Facebook,
  • Twitter,
  • Google Plus,
  • Pinterest,
  • LinkedIn,
  • Delicious,
  • Digg,
  • StumbleUpon.

Here is HTML to create a Tweet button:

<div id="twitter"></div>

You can pass data attributes and script will pick them up for you:

<div id="twitter" data-text="Yummy!" data-url="http://pinterest.com/deegong/steak/"></div>

For me it's very straightforward and convenient way, as I can generate data attributes dynamically on server and pass them to Javascript very easy.


The javascript (depends on jQuery) looks as follows:

$('#twitter').sharrre({
    share: {
        twitter: true
    },
    template: 'Tweet [{total}]',
    enableHover: false,
    enableTracking: true,
    buttons: { 
        twitter: {
            via: 'ruchevits'
        }
    },
    click: function(api, options){
        api.simulateClick();
        api.openPopup('twitter');
    }
});

Options are well documented here: http://sharrre.com/#documentation


The script will bind an onClick to #twitter container and place the following inside:

Tweet [0]

That was actually the expected behaviour, when I tried things myself without even reading documentation. Really pleased that there's no any weird output.

Here is what you get onClick in a popup, resized to fit content:

Twitter share popup


The script is just about 14kb (minified addthis_widget.js is roughly 7kb, but it doesn't include any sharing calls itself).

And finally, it is updated regularly (last update - 10 days ago), so you can check Github for any updated third-party URLs.

I sincerely recommend this plugin to anyone who likes "transparent" lightweight code.

Personal THANK YOU! to Julienh on Github for the great job!


EDIT:

Took me about 30 minutes to make these metro buttons fully working. :)

Metro buttons

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.