I am using
<div class="fb-share-button" data-href="" data-layout="button_count" oncklick=""></div>
to have Facebook sharing on my page.
Now I am wondering why it is not possible to add any events to fire a function if the share button was clicked like this:
Is there any way i can achieve to add a function to the click? I want to be able to use a ajax callback to store into my database that the button was clicked, but i can not use an app id as it is a site for different customers.
Anyone with a solution?
Best How To :
Most common solution
Your best bet is to make a custom facebook share button that you have more control over, using facebook sharer links.
Here is some code to get you started:
<a href="https://www.facebook.com/sharer/sharer.php?u=blah.com">Share on Facebook</a>
You can also link/redirect to a facebook dialog, though by the looks you need to create a facebook app, which is a pain.