Have you ever wanted you own MySpace tracker? Well look no farther. I’ve decided to convert Jordan’s MySpace tracker to be used in a web application framework. The framework I’ve chosen is Kohana and originally was a fork of CodeIgniter. The code originally was going to be used as a reference for Jordan so he could see what it looks like. Anyways, the tracker is simplistic and doesn’t have all the features that I’ve seen in some of these MySpace trackers. It wasn’t designed to be a full solution or as a replacement. It is good enough for me and I’m sure you’ll find it useful.
Well what does this tracker have? The tracker records the IP address, User Agent, HTTP Referer, Date, Time as well as a tag. The tag is just the name of the picture you use in the link. If you created an image tag <img src=”http://somehost/t/tag-name.gif”> Then the tag name that would show up in the tracker would be “tag-name”. That way you can track multiple profiles or blog posts on MySpace with the same tracker. All you have to do is put an image tag with the link into your profile headline. That way if your profile is set to private it will still record everyone that has clicked on it. It will also record information when someone searches for you. MySpace seems to be upgrading their search so this might not happen as often as it used to.
Once you start getting a few profile views there will be two columns that show up as “unknown”. Using the viewer column you can assign a name to an IP address. You will have to determine who’s IP address it actually is by other means since this cannot be automated. I suggest using a combination of geo ip location service as well as whois information. That way you can tell the rough location of the person’s IP address as well as their ISP. The other column “profile” will also show up as “unknown” this this is going to be your “friendid” or URL to your profile. If you managed to put a link into someone else’s profile through their comments then it could also be their “friendid”. If you put your mouse over the IP address it will show the user agent information in a tool tip. Finally, if you hover your mouse over the info column it will show you any additional parameters. That is only really useful for searches so that you can see what page you came up on and what exactly someone was searching for.
Now let’s talk about the setup. First you will need you own hosting with a PHP5 version >= 5.2.0. You will also need several other extensions as well. You will also need access to a database preferably MySQL since that is the only database I’ve tested with (also I don’t have another database schema). Please use the Kohana database documentation as a reference.
You should only have to modify at most 3 files to get this working correctly. The first file is .htaccess and you will need to change RewriteBase if you uploaded the files in any other location than document root. If you put all the files into a folder /tracker than change the RewriteBase path from / to /tracker. The next file you need to change is application/config/config.php, but only if you don’t have the files in document root. In that file you will see $config['site_domain'] and you will need to change / to what you put for RewriteBase. Assuming you have put the files into a folder called /tracker then your configuration should match below.
# Turn on URL rewriting RewriteEngine On # Installation directory RewriteBase /tracker
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Base path of the web site. If this includes a domain, eg: localhost/kohana/
* then a full URL will be used, eg: http://localhost/kohana/. If it only includes
* the path, and a site_protocol is specified, the domain will be auto-detected.
*/
$config['site_domain'] = '/tracker';
The next file you are going to change is the database configuration application/config/database.php. You will need to change the user, pass, host and database variables to match your own configuration. At this point you will need to create a new database and user to match what you have provided in the configuration. Once that has been done then import the MySQL schema into the newly created database.
You should be able to open your web browser and login. The default username and password is admin / admins. Here is a demo of the tracker that you can log into. Now you need to setup your MySpace profile with an image so when people visit your profile and request the image is saves their information into the tracker. Please use the following as an example. You will need to change the hostname and path if you didn’t install it into document root.
<img src="http://mstdemo.hackdd.net/t/ms-tracker.gif" />
If you had installed it into the /tracker directory then it would look like this.
<img src="http://mstdemo.hackdd.net/tracker/t/ms-tracker.gif" />
Don’t actually use those for testing in your profile if you care about others seeing your IP address!
The passwords are stored in the MySQL database and are salted with a value I’ve provided. If you wish to change the salt then you will need to open the login model and change $this->salt to a new value. You have to be logged in while you do this so that you can change the password after you changed the salt. If you don’t then you won’t be able to log in. The tracking link by default is going to be /t if you wish to change this to something else you will have to rename the controller t.php to something else. You will also have to change the controller name inside the file. There is documentation available for this.
As always all of my code is GPLv2 unless noted otherwise. You can download the MySpace tracker here.
Update (September 03, 2008)
If configuring everything is too much for you or you don’t have any hosting, you are welcome to signup and use my tracker. Just follow the link http://mst.hackdd.net.

Hi my name is Paul Sanderson an in feb this year I started this http://www.wscoop.com its a digg style site but dedicated to web design and development
But I need your help….
I need links to web design and development, site , articles links…… anything you think of…. also voting no topics that you think are relative and like would also be a great help.
Please are you able to help me make this into a great resource for developers and designers.
You are more than welcome to promote your own sites, projects, comments and all… at the moment the posts go straight to the font page to it is good exposer and at least some sweet backlinks
A mention or two about wscoop in you blog would do wonders too.
Thanks
Paul
Been trying to use your link http://mst.hackdd.net. but keep getting “unable to complete request” go to home page or try again error. I am unable to register on the site.
It should be fixed now. I added a timezone option and I forgot to update the function for creating a new account.
I’ve been using your tracker at mst.hackkdd.net for a few months now and I love it, but for the past two days it’s been giving me this message: “Unable to Complete Request”. What’s going on?
I’m not sure. When I first visited the site it appeared to be down completely. I was having issues with DNS and resolving the site but eventually it came back up and I was able to login. I looked at the errors you were receiving and I’m not sure why you were getting them. Could you try again and see if it is working now?
Nope, still giving the same message (in IE and in Firefox, if that would make any difference…)
I really appreciate your help.
I downloaded the code for your tracker and set it up on a free hosting site. After many hours of learning, I finally got it set up – and it’s giving me the exact same message yours is.
It must be in the code somewhere, somehow, right?
Well it could be but I’ve tried both IE and Firefox and I can’t get it to break.
http://mst.hackdd.net/tracker
http://mst.hackdd.net/index.php/tracker
After you login try going to those pages and let me know if it works.
Nope, same message. I’ve tried at home and at work, thinking that something could’ve possibly been messed up on one of the computers. Any ideas?
I made a new account with you, and it works, so far; I’ve successfully signed up and logged in. The old account (which I would really love to get back into) is still kicking up that error message.
The old one suddenly started working again, yay!
I haven’t changed anything so I’m not sure what could have been causing it. At some point did you clear your browser cache?
Not at home; I tried clearing my cookies for your site, however. At work, my cache and entire browsing history gets cleared every day for privacy.
I discovered I still get the error message on page two of my original tracker – but only on page two. The other pages display just fine. This is all very strange…
How difficult would it be to change this tracker to where it would set a cookie to identify a return visitor, in case their ip address changes? I think that would be an awesome feature to add. trackspace.net uses this method and gets really good results; many hits are connected to the same person that I would’ve thought were different people otherwise.
The IP address is unlikely to change between requests coming from the same user. It might change if the person is using DSL or if they are still unfortunate enough to be on dialup. The other consideration would be how often a user clears their browser cache vs how often their IP changes. It seems that this wouldn’t make much of a difference in the long run. I won’t be implementing this anytime soon but I may sometime in the future.
I asked because I had noticed mine changing frequently lately (at least once every week or two) and someone who likes to stalk me on myspace went unnoticed for weeks because their ip address changed a couple of times and I hardly ever check my trackspace account anymore.
I’m a total beginner at php and the like, but maybe I can pick up enough to implement something like that for myself. *heads off to start researching*