Tweet button support for www. and non-www. version of domain


#1

With heroku changing its support for root domains I’ve had to move my site from http://mysite to http://www.mysite.

Is it possible to get the tweet button to count links to both? So a single button will count links to http://mysite…/somepage and http://www.mysite…/somepage?


#2

Hello David,

You have a few options. In the tweet button , you can set a url param in the share url which will override the url of the page.

e.g.: Tweet

You can also use data-url and rel canonical in . For more information on the options here: https://dev.twitter.com/docs/tweet-button#properties


#3

Hi Ara,
I can’t quite decipher the docs on this sorry.
If I set counturl=http://www.mysite/A, then links tweeted with and without the “www” will be counted? Or should it be the other way; where the actual URL has the “www” and the counturl does not?


#4

Oops looks my code example didn’t come out right.

Example of tweet button with url parameter:

Tweet

This way irrespective of whether the page is www.mysite.com or just mysite.com, the value in the url parameter is used for the count.

Make sure your url is encoded. You can something like this: http://meyerweb.com/eric/tools/dencoder/

Hope this helps.


#5

#6