tags:

views:

316

answers:

3

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"&gt;&lt;/script&gt;

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.

+1  A: 

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!

Ritesh Manchanda
Thanks, but this does not seem like the problem. I've prepared a new example at http://whattheplace.com/static/tweetbutton.html I've clicked all tweet buttons, but only the last two (the ones, pointing to a .html file) will count. I don't see what the difference between the last two and the 3rd and 4th URLs is since both are valid HTML documents without redirection (the first two URLs redirect which might be a reason why they don't work).
ChrisM
A: 

Hi

I think you are missing data-via="#"

<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.whattheplace.com/Show/1/" data-count="vertical" data-via="#">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"&gt;&lt;/script&gt;

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:

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=viralizate"&gt;&lt;/script&gt;
<!-- AddThis Button END -->

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

Trufa
I tried data-via but it just added a "via @#" to the tweet text which is correct in what I think it should do according to the documentation (http://dev.twitter.com/pages/tweet_button). But I'm afraid I don't understand your second recommendation. The problem is independend from AddThis, it happens with the raw Tweet Button, too.
ChrisM
+1  A: 

Hi there,

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!

Claudiu
I tried it with data-counturl on http://whattheplace.com/static/tweetbutton.html (the two buttons at the bottom) with the non-protected Twitter account @chrism_test but it still didn't work. :-(
ChrisM

related questions