2

I created a twitter button using the code and instructions here: https://twitter.com/about/resources/buttons

Here is my code

<a href="https://twitter.com/share" class="twitter-share-button" data-text="The Burger Kings in Toronto at 33497 Yonge St rated 4/5 with 1 review" data-url="http://mydomain.com/d/902463" data-via="mytwitteraccount" data-lang="en" data-count="vertical">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

But the count is not updated when someone uses the button, why is that?

The page url is not exactly the data-url value I have specified it's only a short url that will redirect to the actual url which is longer.

What's the trick here? Should I use the full url or is there something else I'm missing?

2 Answers 2

4

From the button FAQ:

I use a URL shortener and my count isn’t incrementing, what’s wrong?

When asking how many times a link has been Tweeted the Tweet Button uses the URL you ask it to share. If this is a shortened URL this will often return 0. This is because Tweet Button counts the final destination of the URL passed to it, not the shortened one.

If you are experiencing this problem you should use the counturl property and set it equal to the final destination of your short URL. For an example see the Tweet Button documentation.

3
0

If anyone comes across this problem lately it is because Twitter announced that they are deprecating the count feature for tweet buttons on November 20, 2015. More information from Twitter can be found here also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.