I have just deployed this button and everything appears to work fine. I can click on it, submit a tweet and see it appear in Twitter.

My problem is with the counter next to the Tweet button. On refreshing the page, it resets to zero.

No errors or warnings. This happens with both the current stable release and the dev release.

Comments

chia’s picture

Tweet button counter depends on url,
If you access a node by node/{nid} or node path alias, the button counters will be different. As they are considered separate pages by tweet counter.
I use globalredirect to solved this issue.

is this the case?

drupal_acc’s picture

I am not using an alias, but I do notice something odd in how the Tweet Button passes the query portion of the URL to Twitter.

When I click on the count on the Tweet Button, it goes to Twitter to perform a search. I get this:

No results for http://www.mysite.com/?q=node%2F76
Suggestions:

1. Try a more general search.
2. Try using different words.

The link, as used by my site, is:

http://www.mysite.com/?q=node/76

If I do the search manually, using the link as used by my site, then I will find the article.

So, I agree with your statement that Twitter's counter cannot see the pages submitted due to a rewriting of the query string.

How can this be corrected within the Tweet Button module?

I really do not want to be installing additional modules to correct bugs.

drupal_acc’s picture

I had a further look at this:

The full url being passed to Twitter is:

http://twitter.com/search?q=http%3A%2F%2Fwww.mysite.com%2F%3Fq%3Dnode%252F75

The problem is that the last '/' is encoded as %2F but the '%' is then interpreted as a string and converted to %25

node%252F75

I can trace this in the module code to the attributes:

'data-url'     => $options['url']? $options['url']: url('node/' . $entity->nid, array('absolute' => TRUE))

The above snippet works fine and produces an accurate string in the HTML. The problem comes when you click on the counter to perform a search.

Is there a hook somewhere, or is this something Twitter controls themselves?

drupal_acc’s picture

I have traced through the widget.js file supplied by Twitter. It creates an iFrame for the count to be displayed. The issue seems to be that the URL encoding on this pages mangles Drupal links.

I'm raising the issue with Twitter.

drupal_acc’s picture

mrfelton’s picture

subscribe

drupal_acc’s picture

This issue was raised Dec. 7th with Twitter. The ticket I created has been merged. Anyone interested in this should star the thread at Google.

http://code.google.com/p/twitter-api/issues/detail?id=2005

esllou’s picture

so with this bug, basically the module doesn't work? The counter would always be showing as 0?

drupal_acc’s picture

Good news, a fix has just been released about an hour ago. I just ran some tests and the counter does appear to be working properly now.

Can anyone else confirm this?

As If’s picture

Still not working here. I believe the fix was only partial.

pribeh’s picture

Still not working here. Should we be trying a newer version of the module?

dlthomas’s picture

Version: 6.x-1.x-dev » 7.x-1.1

It's not working for me either on posts or teasers... ? Running on 7, is there something special I need to do to keep it counting?

dlthomas’s picture

Version: 7.x-1.1 » 6.x-1.x-dev

Update:

Sorry.... cleared browser cache and it's working perfect. Thanks!

Changing back the version to 6.x-1-dev for the other guys....

Thisismeasad’s picture

Issue summary: View changes