Permanent vs aliased urls for tweet counts in Drupal


#1

I’m having issues with my tweet counts staying at zero on a Drupal website.

Since the Twitter Dev site is built on Drupal, maybe a dev can clue me in.

My implementation of the tweet button uses aliased paths for the data-url and node/nodeid for data-counturl. I’m assume that by doing this that one can basically peg tweet counts to permanent url (node/nodeid), and therefore carry over tweet counts whenever a path alias changes.

Unfortunately, this doesn’t seem to work and my tweet count stays at zero. If I change the code to use node/nodeid for data-url and aliased paths for data-counturl then everything seems to work, at least until I change the alias whereby the tweet count resets to zero.

Pegging the shared url to node/nodeid works for all other share buttons except Twitter

Any ideas?

Here’s my code:

<div>
  <a href="http://twitter.com/share" class="twitter-share-button" 
    data-url="<?php print url($_GET['q'], array('absolute' => true)); ?>"
    data-counturl="<?php print url($_GET['q'], array('alias' => true, 'absolute' => true)); ?>" 
    data-count="horizontal">Tweet</a>
</div>

#2

Could you post a rendered version of the above code?


#3

Sure thing. The above code would render something like this:

Tweet

The url www.example.com/node/123 is the permanently accessible url, and the url www.example.com/example-alias is the easy to remember/identify alias which is based on the title of each piece of content.

Since tweets add in the url instead of a title/teaser combo, I’m hoping to be able to use the alias for the tweet content, and then anchor the tweet counts to the permanent url incase we make changes to the title (and therefore alias) later.


#4

Twitter follows the redirects to the final url, so you need to be counting that, a problem I had with my own shortner.


#5

Ah, I see. Thanks for the heads up!


#6

Hi
Is this working fine for you now??
I am also on drupal - and below is my code

$l = $base_url . url(“node/” . $node->nid);
$out .= ‘


Tweet
’;

But my tweet count remains at 0, even though the tweets are happening. what am I doing wrong?


#7

What’s the URL you’re trying to share? If you could provide a rendered view of the above code and an example page where the counter doesn’t increment, it would help.


#8


this is my URL
And the rendered code is as follows:


#9

This is working fine now - without any changes from my end.


#10

I just suscribe here but i dont know what,whats can anyone tell me


#11

#12