expandUrl passes 11,000 mark (at least)

Since announcing the launch of expandUrl and fixing the few bugs that cropped up in the first week or so, I have barely given the service a second thought. The API works incredibly well for my own sites which take advantage of it.

Today, after receiving a report that the service was unavailable last night, I took another look at it. Still not sure why it went down, but while I was working on it I’ve added some basic logging (for troubleshooting purposes) and looked around the internet to see if people are using the service.

Since logging was never included in the first place, the only way to surface a reasonable count of URLs was to count the cache files. Since cache files are programatically deleted, I was pretty shocked to find over 11,000 files in that directory. Now that I have actually logging in place, the site displays a counter. Today’s count? 11,411 URLs expanded!

Of course, people only know about the service because of the folks who have helped spread the word about it! Thank you to all these folks for mentioning expandUrl:

  • Blog Brasil Academico “If you prefer a cleaner and more free advertising try expandurl.com.”
  • Troy Sabin “The Yang to the URL shortener Yin – URL expanders”
  • Free Nuts #2 in their top ten URL expanders list!
  • Borrowed Code Mentioned as part of a blog entry about fighting Twitter spam.
  • Benny ChenAfter failing to find a good solution, a short address before the humble beginning to run out to restore the service; Can only say that a group of prescient people, ah!
  • Kate Morris “There is another useful tool available – http://www.expandurl.com – it shows you not only where it goes, but how many times it is redirected and how. :) Not my tool, but a friend built it.”

Finally, I discovered a Google Code project that integrates the expandurl API into Google Chrome. This is very cool to me, as it means the service will be used by lots of folks (even if they don’t know they’re using it!). :)

Not too shabby for 221 days in. ;)

Hacking Lessn To Track Statistics

When Shaun Inman shared his URL shortening PHP script Lessn, I was pretty excited.

Right now I use kl.am, a free service from Raven SEO Tools, for all my URL shortening needs. It’s awesome and 99.5% perfect. But I’ve really wanted to host my own for three reasons:

  1. I want bulk uploads with custom short URLs so I can have predictable, product SKU short URLs.
  2. I want to be able to repoint a short URL if it’s old URL changes or 404s.
  3. I don’t want to compete with other users for custom URLs.

Unfortunately, rolling my own will mean I miss out on all the amazing coolness of kl.am. Mine wouldn’t be as slick or easy to use. However, Lessn is slick and easy to use. But it doesn’t do custom URLs and it doesn’t track how often people visit a short URL. So I added those features.

Tracking clicks

In the file /-/db.php, add this statement to create a second table:

mysql_query('CREATE TABLE IF NOT EXISTS `'.DB_PREFIX.'stats` ( '.
'`id` int(11) unsigned NOT NULL auto_increment, '.
'`url_id` int(11) unsigned NOT NULL, '.
'`ts` datetime NOT NULL, '.
'`ua` text character set utf8 collate utf8_unicode_ci NOT NULL, '.
'`ref` text character set utf8 collate utf8_unicode_ci NOT NULL, '.
'`ip` int(4) unsigned NOT NULL, '.
'PRIMARY KEY (`id`), '.
'KEY `url_id` (`url_id`) '.
') ENGINE=MyISAM DEFAULT CHARSET=utf8;');

Then, in the /index.php file, add this line right after the header(‘Location:’); line:

mysql_query("INSERT INTO `".DB_PREFIX."stats` SET `url_id`='".$row['id']."', `ts`='".date("Y-m-d H:i:s")."', `ua`='".mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])."', `ref`='".mysql_real_escape_string($_SERVER['HTTP_REFERER'])."', `ip`='".sprintf("%u", ip2long($_SERVER['REMOTE_ADDR']))."' ");

To test, go visit one of your short URLs, and then go check the stats table. You should see a new entry in the table.

Now, how you choose to display the data from this table is up to you. :)

The Art of the Milestone Tweet

As my 500th tweet, I’d like to share some examples of milestone tweets. Everything you see are other folks #500th tweet from the last 24 hours.

The Britney Spears #500

As in “Oops, I tweeted again:”

@twools Tweet #500 - D'oh!
@twools Tweet #500 - D'oh!

The World’s Greatest Achievement #500

Because tweeting is a big deal.

@akashsablok Tweet #500 - Key to the City
@akashsablok Tweet #500 - Key to the City

The Is Every Tweet This Exciting? #500

You’d be amazed at the tweets that led up to this one. (“Just wrote my 498 tweet,” “Just wrote my 499 tweet,” etc.):

@Effcom Tweet #500 - Just captioned this image.
@Effcom Tweet #500 - Just captioned this image.

The Shameless Plug #500

Don’t get me wrong, I do a lot of “marketing” on Twitter, too. But you should see some of the slides in that prezo. Not Tweet #500 worthy, imho:

@EricssonLabs Tweet #500 - Slide 5 was when I closed the window.
@EricssonLabs Tweet #500 - Slide 5 was when I closed the window.

The This Explains Twitter #500

Shhh! No one is supposed to know this is what Twitter is for:

@ChristianTojil Tweet #500 - Twitter Explained
@ChristianTojil Tweet #500 - Twitter Explained

The Thanks To All The Little People Who Made This Possible #500

Actually, this one is really sweet. :)

@CrankThat_mate Tweet #500 - What are friends for?
@CrankThat_mate Tweet #500 - What are friends for?

The Finally A Reason To Quit #500

It’s a shame that the addiction will have to last to another round number:

@ASecondOpinion0 Tweet #500 - That's it, I quit!
@ASecondOpinion0 Tweet #500 - That's it, I quit!

The Because My Job As A Male Model Isn’t Working Out #500

Yeah, I know, the background image is disturbing. Now you know how the Myspace crowd is dealing with Facebook… they’re taking out their frustrations on Twitter:

@Vansome Tweet #500 - The goggles, they do nothing!
@Vansome Tweet #500 - The goggles, they do nothing!

And finally, if you think Town Hall meetings get violent, imagine if this happened to all the folks above?

@TanujDua Lost 500 Tweets - Seriously, the 7,039 tweets you still have prove that you know how to turn off caps lock.
@TanujDua Lost 500 Tweets - Seriously, the 7,039 tweets you still have prove that you know how to turn off caps lock.

Some things aren’t businesses

From tr.im‘s announcement that they will keep the service alive:

Twitter has stacked the URL shortening business opportunity overwhelmingly in bit.ly’s favour

The problem with that statement is there is no such thing as a URL shortening “business.” URL shortening is a feature of a larger service or, at best, a loss leader to attract attention for your real business. (As the folks at Raven SEO Tools fully understand with their URL shortener kl.am.)