Search code examples
addthissharethis

Sharethis & Addthis


Has anyone figured out how to only increment share counts if the sharing action is completed?

They seem to count clicks.. not completed shares. That isn't a stat that is profoundly meaningful to me.


Solution

  • You can set it so the count displays the 'native' count:

    <script type="text/javascript">stLight.options({ 
        publisher:"Your publisher key", nativeCount:true 
    });</script>
    

    However this only seems to work for Facebook, LinkedIn and a few others. For Twitter, I just replace the ShareThis count with the actual count obtained from the Twitter API, once ShareThis has loaded and the ShareThis markup exists on the page:

    var pageUrl = 'http://www.google.com/';
    
    updateTwitter();
    
    function updateTwitter() {
    
    if (jQuery('.st_twitter_vcount .stBubble_count').length > 0) {
        jQuery.getJSON('http://urls.api.twitter.com/1/urls/count.json?url=' + pageUrl + '&callback=?',
        function(data) {
            jQuery(".st_twitter_vcount .stBubble_count").html(data.count);
        });
    }
    
    else {
        setTimeout(function() {
            updateTwitter();
        }, 50);
    }
    
    }
    

    Just change the pageURL variable to the URL you want to display statistics for.

    Hope that helps,

    Kamal.