Tweet Button - Hide Zero

I'm interested in adding some of my sites to the official Tweet button recently released by Twitter.

For those who don’t know, the tweet button is a simple JS bit that you can go to the page, and it allows your users to easily tweet about the page in question, just like the sharebok share button.

3 different styles are available:

Tweet button styles

The horizontal account button is the one I would like to place on my pages. My problem is that approximately half of my pages are likely to have a zero score, and I would rather not show the score when this is the case. For example, the facebook share button does an excellent job of this particular situation - if there are> 0 shares, then it shows the score. Otherwise, the counter remains hidden.

I went through twitter tags and can't find a way to specify this in JS options.

I also spent some time trying to grab the account through jquery and hide it, but quickly ran into cross-domain access resolution issues -

console.log($('.twitter-share-button').contents().html()); 

returns a Permission denied error due to iframe loading from platform0.twitter.com .

Has anyone else found a successful way to get this button to conditionally show the number of tweets, as described above?

+7
button twitter social-networking
source share
2 answers

A google search later found by http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/ , which talks about how to use the api counter http://urls.api.twitter.com/1/urls/count.json?url=URL-TO-GET-COUNT-FOR .

+2
source share

Not the most elegant solution, but you can always stagger the release of various types of buttons.

For example, first show the "no account" button, then display a "horizontal account", say, a week from the date of publication. (I suppose you are using some kind of blog)

Again, not very, but partially solves your problem - you will often show the "zero tweets" button.

Relationship Luke

0
source share

All Articles