LinkedIn Share button with Callback

Hi Guys,

In previous few post we discussed about many social button including Google +1, Twitter, Facebook Like, In this post I will show you how to create a LinkedIn button with a callback.

So without wasting much time and me explaining why callbacks are necessary, lets jump straight to the point

1st step

Write this function and place somewhere in your HEAD tag


2nd step

Include this script somewhere in you HEAD tag


This will make LinkedIn JavaScript API available to your webpage.

Final Step


The final step is to include this bit to where you want your share button to appear


Well I know what you are gonna say. I was surprised too to why LI won’t use a DIV or similar container and make use of script tag, let me tell you what each of the above attributes actually implies

  1. type: Custom type used as is
  2. data-url: This is the URL that people will share. Generally you will use location.href here
  3. data-counter: Where would you like your share counter to appear. 3 possible values are top, right or blank
  4. data-onsuccess: This is the important bit where we place our callback function. Make sure that your callback function is available on your page.

That’s pretty much it and you are able to create a LinkedIn share button with a custom callback.

I hope that this helps




  1. not working

Leave a Reply

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