Tips to Increase Twitter Followers and Detect Twitter Data


Twitter is gaining popularity ever since its launched. Now, website owners have started using the twitter power and they are using twitter not just for updates but for marketing purposes as well. So, how will you reap any benefits from twitter? The answer is simple, More Twitter followers means more exposure to your content. Fine, but how the heck you will have more followers? Read the complete article to find out about it.

You can detect the twitter users if they are logged in while they are surfing your site and you can ask them to tweet your content or even ask them to follow you. Whats important here is, you are asking the Visitor to follow you by his twitter user name. Lets take an example if user (hurricanesoft) which is a twitter user name of mine is surfing your website, you can easily detect and ask me to follow you or tweet your content by my user name like Welcome hurricanesoft, would you mind following me and tweeting my content. I will do the same for you if needed. Thanks. This is very simple example and it’s uses can be of unlimited ways.

Now, lets write few line of Javascript code to acomplish this task

?View Code JAVASCRIPT
1
2
3
4
5
6
 function hasTwitter(data){
  // gets the user's real name
     alert(data[0].user.name);
 // other data is .screen_name, .location and
// data[0].text is the latest update
}
1
<script type="text/javascript" src="'http://twitter.com/statuses/user_timeline.json&count=1&callback=hasTwitter"></script>

The above code won’t work unless the user is authenticated, Twitter’s API will prompt an authentication dialog. We can resolve this issue by providing an extra parameter called “suppress_response_codes” which is meant to be used with apps that can only handle 200 response codes and don’t allow for authentication.

1
<script type="text/javascript" src="'http://twitter.com/statuses/user_timeline.json&count=1&callback=hasTwitter&suppress_response_codes"></script>

As you can see that we are using suppress_response_code so we need to use our own code for error and exception handling for cases where user is not authenticated. Take a look at the following code

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
function hasTwitter(data){
  if(data.error){
    alert('No authenticated user');
  } else {
    // gets the user's real name
    alert(data[0].user.name);
    // other data is .screen_name, .location and
    // data[0].text is the latest update
  }
}
1
<script type="text/javascript" src="'http://twitter.com/statuses/user_timeline.json&count=1&hasTwitter&suppress_response_codes"></script>

Using the above code you can detect the twitter user and ask him to follow you or retweet your content thus giving more exposure to your content.

If you’ve got any thoughts, comments or suggestions for things we could add, leave a comment! Also please Subscribe to our RSS for latest tips, tricks and examples on cutting edge stuff.

Share:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • Furl
  • IndianPad
  • Live
  • Netvouz
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis
  • YahooMyWeb
  • NewsVine
  • Blogosphere News
  • Blogsvine
  • LinkedIn
  • Pownce
  • Upnews
  • BlinkList
  • Global Grind
  • Kirtsy
  • PlugIM
  • ppnow
  • Socialogs
  • Webride
  • Meneame
  • Faves
  • MySpace
  • Yahoo! Buzz
  • Twitter
  • Yahoo! Bookmarks

Related posts

Tagged with: [ ]
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
  • COP
    Wow this is neat. ll surely put its on our site.
  • I am looking to put that on my website too, did that worked for you?
    I wanted to get some sort of reviews before i use the technique mentioned above.
blog comments powered by Disqus