Monday, March 30, 2009

WunderCounter Helps Apprehend Suspected Laptop Thieves

This morning I had a WunderCounter user message me about how she used the site to help recover a stolen laptop. (Thanks, Christine!) I'm publishing it here with her permission :

Hi,

I just wanted to pass along my story. Last week my laptop was stolen. I do not have an anti-theft device like laptop LoJack so the police told me they would check the pawn shops, but it was probably gone forever.

My personal web page is set as my browser home page. In the small hope they might try to surf the internet, I put your IP Logging page counter on my home page. A few hours later, a suspicious IP address was visiting my web page. I was able to give this info to the police and help them track down the thieves and recover my laptop the next day!

So, thank you, thank you, thank you for your service! I needed something that I could add to my web page immediately and your 2 week free trial provided that. The site was easy to use and the police were excited to have some information to lead them in the right direction. Ultimately, I believe they were caught based on descriptions of the get-away car. However, I'm sure the IP address information provided by your service will be a big help in making sure these guys are convicted.

Thanks again!
Christine


This illustrates a use of the WunderCounter which, to be honest, had never occurred to me. :)

Saturday, March 21, 2009

Tracking Perl, PHP, ASP and Other CGI-generated Pages

Introduction


If your web pages are produced dynamically, adding WunderCounter code can,
in many cases, be very easy. If all of your pages are produced by a central
script or use some sort of common header or footer, you can save yourself
a lot of work and start tracking all of your pages within minutes. Here's
how you do it.

Editing WunderCounter Code


First off, you need to generate some WunderCounter code and have a close look
at it. You'll see that the URL that creates the counter is made up of a series
of name/value pairs, like part of the code used to create invisible counters:

&page=index.html&digits=5


What we're interested in for this tutorial is the page=index.html
part of the URL. If you want to the same style of counters across your entire site,
all you need to do is change the page name in the URL for the various pages/scripts
on your site.

This is where environment variables come in. These are variables that
are passed on by the web server and are available to your scripts. The actual
environment variables that are available to your script depend on the
configuration of your web server. Let's get to the examples that should work
for your right out of the box for you.

Please note:


The counter code used in these examples is very basic -- it's only meant to
get you up and running as quickly as possible. In almost every case, you'll
want to create custom code for your site by generating your own custom counter
code (found under the Generate HTML menu). You may then use this custom
code in your scripts for the best results.

Perl (CGI)


Here's an example of a Perl script that will create some basic counter code:


#!/usr/bin/perl

use strict;
use warnings;

use CGI;
my $q = CGI->new();

# print HTML header
print $q->header;

# usually looks like "/script.cgi", so we remove the first slash to get "script.cgi"
my $page = substr($ENV{'SCRIPT_NAME'}, 1);

my $counter_code = qq[<img src="http://www.wundercounter.com/cgi-bin/stats/image.cgi?user=username&page=$page&digits=5" >];

print $counter_code;



If you're using a templating system, like HTML::Template, you can save the
counter code in its own file and then include it in all of your pages via the
TMPL_INCLUDE syntax.

Perl (SSI)


Here's an example of a Perl script that will create some basic counter code,
when used via SSI (Server Side Include)


#!/usr/bin/perl

use strict;
use warnings;

use CGI;
my $q = CGI->new();

# print HTML header
print $q->header;

# usually looks like "/index.html", so we remove the first slash to get "script.cgi"
my $page = substr($ENV{'DOCUMENT_URI'}, 1);

print qq[<img src="http://www.wundercounter.com/cgi-bin/stats/image.cgi?user=username&page=$page&digits=5" >];




Create a folder in the top of your web directory called "wunder". Save this
script in the "wunder" folder as "counter.pl". Make sure the script is
executable. On a *nix machine that would be:


chmod 755 wunder/counter.pl


If you are unfamiliar with Server Side Includes, check the Apache tutorial
Introduction to Server Side Includes
for tips on how to get started. Once you're ready to go, you can include the
counter code in all of your pages by adding the following:


<!--#include virtual="/wunder/counter.pl" -->


PHP


The following example snippet of PHP code can be included by all of your .php
pages. To do so, save the following code snippet as wundercounter.php:



<?

$page_name = substr($_SERVER['SCRIPT_NAME'], 1);
echo "<img src=\"http://www.wundercounter.com/cgi-bin/stats/image.cgi?user=username&page=$page_name&digits=5\">";

?>



Now, you can include the counter code in any page you like, using the following
syntax:


include 'wundercounter.php';



ASP


The following example snippet of ASP code can be included by all of your .asp
pages. To do so, save the following code snippet as wundercounter.asp:



<%
' get the script name from environment variable
strPageName = Request.ServerVariables("SCRIPT_NAME")

' remove the slash that begins the script name
strPageName = Mid(strPageName, 2)
%>

<img src="http://www.wundercounter.com/cgi-bin/stats/image.cgi?user=username&page=<%=strPageName%>&digits=5">



Now, you can include the counter code in any page you like, using the following
syntax:


<!--#include virtual="/wundercounter.asp" -->

Friday, March 20, 2009

Getting Started with the WunderCounter: Info for First Time Users

So, you've created a WunderCounter account. Now what? Let's briefly walk through the steps to getting some counters and trackers working for you. If you take the time to read this article, things may make a little more sense. It will probably take about 10 minutes for you to read this article and start tracking your stats. It's a pretty simple process.

Step One: What Are You Tracking?

There are different types of counters, so the first part of the process is figuring out which is the best counter for you. Let's keep it simple for now. We won't talk about any of the fancy stuff here. We'll look at simple web counters -- the ones that increment every time someone visits your page.

There are basically really two types of counters: JavaScript or plain HTML. Both counters work equally well, but the JavaScript counter provides more helpful information. The general rule is that if you can use a JavaScript counter, that should be your first choice. If the page you want to track doesn't allow to you add JavaScript, then you should choose HTML.

For example, you should choose HTML if you're tracking:

Myspace Profiles, Bulletins, Photo Albums, etc
Links in Facebook Notes
Ebay Auction Items
Google Ads

You should choose JavaScript if you're tracking:

Your personal web site
Your business web site
Blogger.com
Blogspot.com
Zorpia.com
Any site you're accessing via FTP

Those are just general rules. If you use the WunderCounter on a site which is not mentioned here, please email me or comment back about which site it is and whether you're using HTML or JavaScript. It's helpful for me to know!

Step Two: Choose the Correct Code

If you've got the Wunder Free account, there's only one choice for you to use (the visible HTML counter), so your choice is easy. If you have Invisible or the Premium account, you'll find more choices. For all accounts, you'll find your available options under the Generate HTML menu on your dashboard page, after you've logged in.

For example, if you're tracking a Myspace page, choose Myspace Trackers from the Generate HTML menu. The Myspace Tracker is an HTML counter, so you can use it on other sites which don't allow JavaScript. It's just called the Myspace Tracker because that's what many people use it for. It's invisible, so you won't see an incrementing counter appear on your page, so a lot of people choose this option. You can also use it for eBay items etc, so feel free to play around with this type of counter if you want to track a social networking site or some other place which doesn't give you total control of your HTML layout.

If you're generating a counter for your personal or business site, you should be able to use pretty much any counter available on the menu. Experiment a bit to find a format which you like.

Step Three: Generate Your Counter Code

This is the easy part. Once you know which sort of counter you want to create. Just choose that option from the Generate HTML menu and click through the steps. It's pretty straighforward, so it often takes less than a minute to get through this part. At the end of the process, highlight and copy the code which is presented to you. You're now ready for the last step.

Step Four: Add the Code to the Page You'd Like to Track

Here are some instructions for specific sites:

Myspace Profiles
Myspace Blogs
Blogger/Blogspot.com

If you're adding the code to a site you have FTP access to, just add the code to the body of your HTML. Add it close to the top of the page, preferably just under the <body> tag. Then, save your page and upload it to your site. You're done!

Did it Work?

No matter which counter you're using or which site it's on, you should always check to ensure that you've added the code correctly. Preview the page in your browser, making sure you refresh the page if it's already open in your browser. Once you have viewed the page with the counter, log in to the WunderCounter and check to see if that page has appeared on your dashboard page. If it has not, try clearing your browser's cache and then reload the page. Reload the WunderCounter dashboard page and check to see if the page name has appeared on your dashboard now. If you don't see the page, try starting again from step 1. If that doesn't work, contact support, by sending an email to support@wundercounter.com. Include the full URL of the page in question. Do not remove the code which isn't working as it won't be possible to find the problem if the code is not in the page.

You're Done!

So, basically that's it. Continue adding counters to as many pages as you'd like to track. Keep checking your dashboard page to make sure they appear. Once you're happy with that, sit back and watch your traffic roll by. You'll be surprised at what you may learn!



Thursday, March 19, 2009

Tagging IP Addresses and Myspace Users

A Powerful Feature

One of the most useful features that has been added to the WunderCounter over the past year or so is the IP Tagging feature. At the very least, I should say that it's one of the features which I personally find very useful. I use the WunderCounter to track my own web traffic, so I hope that when I find a feature to be useful, there are lots of you who feel the same way. What clued me in to the importance of IP Tagging is that despite the fact that I added this feature without including any kind of documentation, there were already users tagging IPs within about 5 minutes of the feature being available. That's pretty powerful stuff.

How Does it Work?

Here's how it works. When you log in to you account and view your log files, you should see a column with IP addresses. You'll see a link beside each IP address which is (appropriately) labelled "tag". Click this link and you'll be able to tag your IP. How should you tag an IP? Well, it's really just a nickname or some identifier of your choice. It's hard to look at an IP and say, "that's my friend Dave". So, when you see an IP number come up which you may happen to know is Dave's you can tag with his name. The result is that, in future, when you view your log files, you'll see Dave's name along with his IP number. It makes log files easier to scan and a lot more fun.

A Practical Example

Here's how I use tagging. Whenever you log in to the WunderCounter, I automatically tag your IP with your username. That way, when people email me and say, "I had problems with this feature", I can just view my log reports and follow that user's tags. It makes it a lot easier to figure out what is going on. Auto-tagging is not yet available for users other than myself, but I will make it available via the API if enough people bug me about it. As an aside, if there's something you really want to see, please bug me about it. It may take a fair amount of nagging, but the more you get in my face, the more likely I'll be to add your future. Maybe I'll post an article in future about how to get your feature added, but for now, just let me know what you'd like to see. IP Tagging was a user request and you can see how useful that is for everybody.

Tagging Myspace Usernames

If you're using the WunderCounter to track your Myspace profile, you should consider tagging IPs with the Myspace usernames of your friends. Since it's not possible to automatically associate an IP with a Myspace username, this is the next best thing. You may be able to do this by checking what time friends leave comments on your page and matching this against hits in your log files. Try it out -- you'll be surprised at what you can discover.

Managing Your Tags

Once you have created tags, you may want to alter or delete them. To do so, choose:

"Options" -> "IP Tagging" from your dashboard page. To edit a tag name, just hover over it and click on the name. You'll be able to change the tag name and save it without needing to refresh the page. To remove a tag entirely, just use the "delete" link to the right of the tag.

It's that simple. If you haven't used this feature yet, I encourage you to try it out as soon as you can. It will make your tracking that much more enjoyable!


Saturday, March 14, 2009

How Do I Set My Time Zone?

If North American Central Time is not your time zone of choice, there's no reason you need to view your WunderCounter reports in this time zone. To choose a different time zone:
  1. Log in to the WunderCounter
  2. Choose "Options"
  3. Choose "Time Zone"
From this page, select your country and then choose one of the available time zones. This will immediately switch all timestamps in your log files to the time zone of your choosing and you will no longer need to add or subtract time when trying to decipher your log files. :)

Myspace Headline Tracker Broken in Private Profiles

I've just had a conversation with WunderCounter user who has confirmed that the Myspace Headline Tracker is currently only working when profiles are set to public. (Thanks, Molly!)

I haven't played with this myself, but what I have been told is that if you have a WunderCounter Tracker in your Myspace headline, it will work when your profile is set to public. However, if you set your profile to private, Myspace will expose the WunderCounter code in the headline. This has the affect that:
  1. Page hits will not be tracked
  2. It looks really messy
There's no workaround that I know of at this time. If your profile is private, you'll need to put your tracker code somewhere other than your headline. That way you'll be able to track page views from your friends. Unfortunately you'll no longer be able to track page views from people who aren't your friends, but who tried to view your profile. This is a limitation imposed by Myspace (whether it's intentional or not, I can't say) and it's in no way a problem with the WunderCounter.

If, at some point in the future, this changes, please do let me know so that I can update this post.

Which Operating System is My Web Server Running?

Occasionally you may want to install some new software (perl/php/python/ruby etc) in your web hosting account. The developer you're working with may ask you which OS (operating system) your account is hosted on. You can actually use the WunderCounter to help figure this out.

If you have a Premium account, log in to the WunderCounter. Click "More Stats" -> "Advanced" -> "Server Headers"

Now, enter the domain name of your site and you'll get detailed information which is broadcast by your web server to the world (via HTTP headers).

Let's try a couple of examples. If you enter:

www.microsoft.com

You'll find the following information:

Server: Microsoft-IIS/7.0

OK, so that makes sense. Microsoft is using it's own products.

How about:

www.myspace.com

Server: Microsoft-IIS/6.0

So, Myspace is also using Microsoft software, albeit an older version.

Now, how about:

www.wired.com

Server: Apache/2.0.52 (Red Hat)

Now, that's getting better. Wired is running off Red Hat Linux and Apache2. Now, that's an older release of Apache, but it's nice to see them using Open Source software.

Lastly, let's have a look at my favourite flavour of Linux:

www.ubuntulinux.org

Server: Apache/2.0.55 (Ubuntu) PHP/5.1.2 mod_ssl/2.0.55 OpenSSL/0.9.8a

So, that's a good sign. Ubuntu is running Ubuntu Linux. :) They have a recent version of PHP compiled in with the Apache web server as well as SSL for serving secure web pages.

You can use this feature to get lots of other interesting info from web servers (like the kinds of cookies they set etc). Feel free to play around with it and see what you might learn. Also, feel free to use this tool when trying to dig up information on your own web host as well.

Thursday, March 12, 2009

How To Create Google Friendly URLs

When you're trying to drive traffic to your web site, it's a good idea to make it easy for Google to figure out what your site is all about. Now Google is already very good at doing this, but it doesn't hurt if you give it a little bit of help. One very easy way to do this is to give your pages appropriate URLs.

In the past, many web designers have been fairly unimaginative when naming their web pages. You'll often find pages with the following names:

contact.html
about.html
bio.html
directions.html

Those are good page names for a web designer because they're descriptive of the page content and they help the designer easily find the file s/he is looking for when edit the content of your site. The problem, however, is that these names are generic and they don't really tell Google too much about the actual type of content in your web site. What do I mean by this? Well, have a look at these page names:

contact-perl-web-developer.html
about-toronto-on-florist-shop.html
vile-richard-music-bio.html
directions-to-toronto-on-music-studio.html

Do you see the difference? When you see these page names you know what they're about, but you also have an idea of what sort of site you're dealing with.

a) a web developer who specializes in Perl (great choice!)
b) a flower shop in Toronto, Ontario
c) a musician's bio for "Vile Richard"
d) recording studio in Toronto, Ontario

If you can glean this sort of information just by looking at a page name, you know that Google can do the same. The key is to find a few keywords which you'd like to focus on when driving traffic to your site. Then, use these keywords when naming your pages. Take care not to stuff your page names with so many keywords that you've actually obscured the meaning of the title, but be creative.

The format you choose to use is up to you, but I personally prefer to keep everything in lower case, using dashes ("-") in place of spaces or punctuation. Google will be able to strip the dashes out of your page names and make sense out of the words. It will then take these words into consideration when ranking your site in importance for searches on these same words. So, if you choose your page names wisely, you may well drive extra traffic to your site with only a tiny bit of extra effort.

Wednesday, March 11, 2009

Should I Pay to Submit My Site to Search Engines?

This is a question which people ask me fairly regularly. The short answer is:

NO.

The long answer is:


You don't have to tell search engines where you are. The search engines will find you. After all, that's what they do.


So, please, whatever you do, don't spend your hard-earned dollars on a search engine submission service. If you really want to part with your money, donate it to your local SPCA, or the shelter where I adopted my cat. These are organizations which could really use your money. A search engine submission service is just going to bank your dollars and offer very little in return.

So, if this isn't a service you should buy, what should you do? Let's be realistic here. If you want to be found online, you want Google to find your site. Maybe you'll add Yahoo to that list, but after that it becomes fairly irrelevant how many other engines pick up your site. (I'm speaking of English language web sites now). The majority of users online are now in the habit of using Google (and occasionally Yahoo) to perform their web searches. There are lots of other search pages out there, but very few will ever drive significant traffic to your site. Trust me on this. In some cases these other search engines are really just portals which feed you information from a larger search engine anyway. The bottom line is that you want Google to find you. After that, everything else is gravy. So how do you do this?

Submit Directly to Google

Google has a page with some useful info to get you started. I recommend you have a look at that. However, if you just want to submit your site to Google directly and be done with it, you can use the Google site submission page. This will officially let Google know that you exist. Now just sit back and wait for the magic to happen. So, if you all you wanted was to have Google notice you, you're done. You can quit reading and check your TiVo to see if the latest episode of Chuck was recorded. If you want to improve your rankings once Google does find you, read on.

Have Other Sites Link Back to You

One way to ensure that your site will be picked up and treated well by Google is to have other sites link back to you. Send out an email to friends or businesses you work with, asking them to post a link back to your site. Offer to link back to their sites as well, since this may give them more incentive to add your link. You can also add your link to the WunderCounter's free directory. There's no requirement to link back to the WunderCounter, but it is appreciated. Find directories online which offer free listings. Use these listings to link back to your site.

How Do Links Help?

When Google is searching the web, it follows the links which it finds. When it stumbles across a link to your site, it will officially know that your site exists and you'll be scheduled to be added to its index. The more links which Google finds which point to your site, the more important Google will assume your site is. This is a simplification of how the process works, but basically, think of it this way:

If thousands of web pages link back to your web site, Google will assume that this is an important web site and will take this into consideration when spidering the site and producing search results -- this is a good thing. Conversely if zero or very few pages link back to your site, Google will also take this into consideration -- this is not a very good thing. You're not likely to appear in the top results of many searches, which means that you'll be in the Google index, but most people will never find you.

So, what you want to do is get your site out there. Let people know about it. Find online directories which offer listings for free. Pester your friends to link back to your site and just generally make sure Google is aware of your existence. This will not only get your site indexed by Google and the other search engines, but it will also increase the likelihood that user searches will produce results which list your site.

This really just scratches the surface of how you can get more people to find you online. If you're interested in further articles on how to optimize your site for search engines, email me or comment below. Or, if you have your own tips, you can add those in the comments as well.