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:
https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.mysit...
Is this related to the use of the Shorten module (project/shorten)? Has anyone solved this issue?
Comment | File | Size | Author |
---|---|---|---|
#7 | Service-Links-Twitter-Count-1918462-7.patch | 1.26 KB | Proteo |
Comments
Comment #1
TheCrow CreditAttribution: TheCrow commentedput the address of your website...
Comment #2
Simon Georges CreditAttribution: Simon Georges commentedComment #3
tvilms CreditAttribution: tvilms commentedHere it is. Thanks.
http://www.musiceum.com
Comment #3.0
tvilms CreditAttribution: tvilms commentedMinor edit to explain I'm not using a real URL
Comment #4
leeotzu CreditAttribution: leeotzu commentedI am also facing same issue. Any resolution to this?
Comment #5
Proteo CreditAttribution: Proteo commentedHi 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 Bit.ly service) to format the counturl parameter in the link's URL, not the actual node URL (instead the Bit.ly 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: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 fromwidget_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.
Comment #6
jenpasch CreditAttribution: jenpasch commentedStill an issue.
Comment #7
Proteo CreditAttribution: Proteo as a volunteer commentedHi 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.
Comment #8
drupalove CreditAttribution: drupalove commentedThis 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.Comment #9
orcode CreditAttribution: orcode as a volunteer commentedAccording to Twitter, tweet counts were removed from the JSON response and the tweet button a couple of months ago:
https://twittercommunity.com/t/a-new-design-for-tweet-and-follow-buttons...