Tag Archives: twitter

Get Twitter and Facebook Link Statistics with JSON and jQuery

Both Twitter and Facebook have little JavaScript widgets that allow you to share a page using the respective service, displaying a running total of users who have done so. While that’s fine for most purposes, what if you just need the count, for some atypical application?

It’s not well-documented, but the two social media sites have JSON APIs for that purpose.

With a little bit of jQuery magic, you can collect the values on page load and update the DOM with the number. Here’s something I threw together for a project I was working on:

(function() {

var url = 'http://xkcd.com/792/';

jQuery.getJSON("http://urls.api.twitter.com/1/urls/count.json?url="+url+"&callback=?", function(data) {
jQuery('#socialstuff span.twcount').html(data.count);
});

jQuery.getJSON("https://graph.facebook.com/"+url+"&callback=?", function(data) {
jQuery('#socialstuff span.fbcount').html(data.shares);
});

}());

As long as you remember to include jQuery, and have the right HTML elements for the JavaScript to populate, it’s pretty much plug-and-play.

You can see it in action here.

Klout: Measure Your Twitter Influence

Klout is a service that provides all sorts of fascinating metrics about you—and the people you interact with—on Twitter. It measures things like the number of users who are actively engaged by your tweets, the “type” of Twitter user you are, and your influence.

It’s neat, particularly if you’re a blogger. You can sort of tell the ratio of “real” followers versus spammers and people who are pretty much ignoring your tweets, based on the “true reach” score. And I find it interesting to see how it maps interactions and figures out who you influence, and who influences you.

Twitter Web Intents

Twitter recently launched a new feature for integrating their service into your website. Web Intents automagically converts links to specific URLs into interactive dialogs, using the same widgets.js dependency as the retweet widget.

You can create links to retweet, reply to or favorite messages, as well as to follow or display a user.

As an example:

<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<a href="http://twitter.com/intent/retweet?tweet_id=53796378291355649">Retweet</a>

More fun things for developers and web designers to play with. And you can now get official logos and UI sprites as well.

Twitter Web Intents [Twitter Developers]

New Bookmarklet for Twitter for Mac

Back when I first started using Tweetie for Mac, I put together a modified version of the default bookmarklet available on the developer’s website. With a single click I could send the URL and page title of the current page in my web browser to Tweetie and hit send. Easy and efficient.

When Twitter for Mac came out, that bookmarklet stopped working, sadly. I managed to get it to send the URL after a little tinkering, but I couldn’t get it to work with the page title for some reason.

Fortunately, an enterprising Twitter user has written a new bookmarklet that works like my old one did. You can install it by going to this page and dragging it to your bookmarks bar.

If that wasn’t cool enough, it turns out you can select some text in any native Cocoa application, right-click it and select “Tweet” to send it over to the Twitter app. It won’t work with Firefox, though, as it’s Services-impaired.

Twitter Starting In-Stream Targeted Advertisements

Twitter is beginning their foray into in-stream advertising, adding targeted sponsored tweets that are targeted based off brands you follow. For example, if you follow Starbucks (I have no idea why you would, but hey…) you might see the occasional paid ad promoting some sort of Starbucks deal.

TechCrunch has a short but informative post on the matter.

Twitter says that these tweets will still be based on targeting. What they mean is that you should only see them if you follow people or products on Twitter that are related to the Tweet ad they have to show you.

Again, for now, these Tweet ads will only appear to users who are using HootSuite, a client which about a million of Twitter’s 175 million users use. But if this is a success, you can expect this to roll out to other clients shortly. And yes, these ads could appear on Twitter.com one day as well.

It’s interesting that they will be limiting their rollout to HootSuite users for the time being, but I suppose they want to gauge users’ reactions before rolling it out to everyone.

Design Spotlight: New Twitter

Twitter is slowly rolling out their new, more application-like interface. Some of you may already have had a chance to give it a test drive, but there are still plenty of tweets along the lines of “I want New Twitter! Why does everyone have it but me?” It seems like now is a good time to take a look at New Twitter, before everyone has it.

The bar floating at the top is statically positioned, so it’s visible as you scroll. This is handy, as you always have a button to post a new tweet within easy reach. Clicking it launches a pseudo-window overlay. It’s nice to have when you’re off looking at someone’s profile or putting together a List.

Continue reading →

HootSuite Adds Paid Plans

HootSuite, the “social media dashboard” has just announced their new premium accounts. There is still a free option, though you will need to fork over some cash if you need “team members” (collaborators who can post to your shared social media profiles) or more than one RSS feed piped into your Twitter streams.

Starting today (Wednesday, Aug. 11th), all new customers will be required to select a plan upon signing-up — including choosing the free option if desired.

The following week, current HootSuite users will be asked to choose a package with the help of a migration wizard to help you choose the best plan.

For all customers (aside from Enterprise-class accounts), we’ll include a 30-day free trial. This period will allow you to experiment and discover which plan best fits your needs. Again, we’ll continue to offer a free plan for those of you who don’t require advanced options at this time.

The paid plans start at $4.99/month and quickly get pricey. I think their tier structure could have used some more work, such as allowing more collaborators and for cheaper plans, but maybe that’s just me…

Twitter Launches Their Own “Tweet” Button

TweetMeme‘s ubiquitous “retweet” button is being replaced by an official “Tweet” button hosted by Twitter. The button looks good and is very customizable, while providing a more cohesive Twitter experience.

In case you were wondering what TweetMeme thinks of this, it seems that Twitter cut a deal with them. TweetMeme now has a recommendation up on their button page, suggesting that button-seekers use the Twitter one instead.

You may have seen similar buttons on blogs, news sites and other places that let you share content on Twitter. These have been created by third parties. Most notably, a company called TweetMeme created a popular “retweet button” for publishers. They’ve already made it easier to share links on Twitter and have helped a tremendous number of publishers get their content into Twitter. We’re pleased to be working closely with the good folks at TweetMeme and, from here on out, they will be pointing to the Twitter Tweet Button. Check out TweetMeme’s blog to learn more about what they’re up to next.

You can find the button setup page here.

Authenticating Users With Twitter OAuth

If you’ve ever played around with the Twitter API, you’ll know that many functions require authentication with either a username/password combination or OAuth. Soon Twitter will be turning off basic authentication for security reasons, in favor of the more complex OAuth protocol. There are plenty of benefits, for Twitter and for users and for developers, but the transition will be a bit of a pain.

Fortunately, Net.Tuts+ has put together a tutorial explaining how to implement OAuth authentication in a Twitter application.

It’s a more complicated than it should be to implement the authentication dance (but it’s very easy for the end user, thankfully). There is one plus to using one of the Twitter OAuth libraries: it’s easier to handle API requests. Need to get a user timeline? If you’re already authenticated, you can just do this:

$nettuts_timeline = $twitteroauth->get('statuses/user_timeline', array('screen_name' => 'nettuts'));

No worrying about cURL or file_get_contents(), the library’s classes take care of all of the boring stuff for you.

Twitter “OAuthcalypse” Coming This June

The Twitter OAuthcalypse is coming!

Twitter has announced to developers that they will be turning off basic HTTP authentication for the API on June 30, 2010 in favor of the more secure OAuth protocol. This shouldn’t cause too much trouble for most users, though developers of Twitter applications need to hurry up and update their software.

OAuth reduces the risk of password theft, as you don’t have to give applications your password. You will also get a higher API limit.

Hopefully Twitter will have Loren Brichter cook up a patch for Tweetie for Mac, as it does not yet support OAuth. (Tweetie for iPhone doesn’t either, but that’s guaranteed to be fixed right away, as it’s now the official Twitter app.)