I am using the official Tweet Button from Twitter to allow users to share my site.
The button itself is working just fine, however the counter doesn't work and stays at zero all the time. (after you tweet, it is incremented client-side, but if you press F5, it will be zero again)
This is my really simple code to include the button:
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.whattheplace.com/Show/1/" data-count="vertical">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
The specified URL (http://www.whattheplace.com/Show/1/) is a regular URL returning a web page with HTTP code 200, i.e. no redirection or the like that could maybe confuse Twitter.
I've prepared a small example on http://www.whattheplace.com/static/tweetbutton.html where you can see the problem. On the "real" page at http://www.whattheplace.com, the Tweet Button is wrapped by AddThis, but the problem is exactly the same.
I'm thinking that it might have something to do with the new Twitter URL shortener (t.co), however I can't prove it and it seems to work on other people's pages just fine.
I think you are missing data-via="#"
If its rapped around the add this im quite sure you should "mix" it with the twitter button itself, shouldn´t you be using something like:
I´m not finding the question clear enough, hope it helps anyway! if you explain further i will gladly edit it! - if i know the answer ;)
Good luck!
Trufa
you must use both "data-count" AND "data-url" if you want to show a count and there is a url shortener involved (and there always is):
There are a few possible problems related to this. One of them is that if the link is shortened, Twitter won't add it up unless you add the "counturl" url property.
Also, Twitter doesn't count the tweets coming from protected accounts (accounts that don't share their tweets).
Please let me know if none of this offers the solution.
Cheers!
I had this problem too and found out that it was related to the value of the "canonical" link tag I had set. It was set to http:// www.iphone4simulator.com but tweet button was sharing http://iphone4simulator.com because I had set my DNS servers to remove www string from the address. As soon as I changed the canonical URL value in the markup to the latter, the button worked like a charm!
Something else to bear in mind is that the tweet counts are not accurate in real time. They are cached and updated asynchronously. See http://dev.twitter.com/pages/tweet_button_faq#count-api-increment
I had luck switching from the URL parameter method to the data- attributes method.
This snippet assumes jQuery 1.5 or greater.