How To Integrate Your Custom API With Tweet This Plugin

Tweet This is a great plugin that allows you to have “Tweet This” buttons at the end of every post. Not only that, it also allows you to have Digg This, Facebook This, Plurk This, and many other kinds of buttons too. You get about 8 button designs as well, so you can find something that you like.

In addition to that, I like this Twitter plugin for its ability to tweet my posts automatically too, whenever I publish new posts on my blog. And the plugin is smart enough to integrate with various other URL shortening services!

My favourite URL shortening service is, because they also have a great statistics and analysis tool. The problem is, Tweet This only creates generic links – in order to use the statistics tool, you’ll need to connect with your own API account.

I couldn’t find this feature supported by Tweet This, so I decided to hack it myself. To do this, just go to your Tweet This plugin folder, and edit the tweet-this.php file that you see inside.

Look for this line, or go to line 359:

$url = tt_read_file(‘’ . $purl);

and replace it with this chunk of code. Remember to change it to your details!

$bitlyLogin = ‘your-login-here’;
$bitlyAPIKey= ‘your-api-key-here’;

$url = tt_read_file(“”.$purl.”&login=”.$bitlyLogin.”&apiKey=”.$bitlyAPIkey);

$response = @json_decode($url, true);
$url = $response[‘results’][$purl][‘shortUrl’];

And that’s it!

You can get your API key here.

Similar Posts:

Alvin Poh lives in Singapore, and is interested in marketing, techy stuff, and likes to just figure out how the two can work with each other. He can also be found on Google+.

1 comments On How To Integrate Your Custom API With Tweet This Plugin

Leave a reply:

Your email address will not be published.


Sliding Sidebar