This is similar to another issue with the Facebook Like button. But this is for the Twitter Tweet button. On my site, the Facebook Like buttons show the count, but the Twitter Tweet button stays at 0. I've searched for a solution, but there isn't too much written about this. Most people seem to be focused on what kind of browser, but this happens across all browsers for me.

For reference, here's an example of what URL the Tweet widget shows:

Is this related to the use of the Shorten module (project/shorten)? Has anyone solved this issue?

Members fund testing for the Drupal project. Drupal Association Learn more


TheCrow’s picture

put the address of your website...

Simon Georges’s picture

Status: Active » Postponed (maintainer needs more info)
tvilms’s picture

Here it is. Thanks.

tvilms’s picture

Issue summary: View changes

Minor edit to explain I'm not using a real URL

leeotzu’s picture

I am also facing same issue. Any resolution to this?

Proteo’s picture

Issue summary: View changes

Hi you all. I've had this issue with a brand new site that was just moved from development to production. After a few minutes I figured out the problem: the widget uses the shortened URL (I'm using the service) to format the counturl parameter in the link's URL, not the actual node URL (instead the URL I should see the canonical URL so, since I'm using Pathauto, I should see node's clean URL).

Since I was in a hurry and all i needed was a quick and dirty fix, I just added this line to the ws_twitter_widget_data() function, in the line # 95:

$service['url'][1]['counturl'] = $subst['encoded-long-url'];

That overrides the shortened URL for the counturl param. I tried doing the same thing changing &counturl=encoded-url to &counturl=encoded-long-url in the $links['twitter_widget'] array from widget_services_service_links(), but for some reason that didn't work, and as I said, didn't have time to go through the code.

I hope the mantainer can gather from this the necessary info to make a proper fix, but in the meantime you can use the little hack above.

Best regards.

jenpasch’s picture

Still an issue.

Proteo’s picture

Version: 7.x-2.1 » 7.x-2.3
Status: Postponed (maintainer needs more info) » Needs review
1.26 KB

Hi you all. As I posted in #5, I solved the problem by changing one line in the widget_services.module file. Today, I updated a couple of sites to 7.x-2.3, again losing the counter in the Twitter button. However, I wasn't able to apply the same "fix", the counter always remains at 0.

The solution happens to be in Twitter's documentation (no surprise). The source of the problem is that Twitter no longer honors the counturl parameter in the URL. Instead, this must be provided in the form of a new attribute called data-counturl: Tweet Button Parameter Reference.

I'm attaching a patch that fixes the problem. It's done against the 7.x-2.x branch in the repo.

Please test and post your results, best regards.

drupalove’s picture

This last patch makes sense but still didn't work for me. The counter doesn't show up, even by adding $params['count'] = 10; still it doesn't show up.

rspnsiv’s picture

According to Twitter, tweet counts were removed from the JSON response and the tweet button a couple of months ago: