Sunday, March 21, 2010

itunes_chicklet

How to track web visitors on your Windows Home Server using Google Analytics

February 4, 2010 by Homeserver  
Filed under Software, Windows Home Server

image

by:  David McCabe, Windows Home Server MVP 2009

I’ve often wondered if anyone has viewed my Windows Home Server Web front-end.  You know, the front end page that you use to log into your WHS console while you are remote.  Maybe you have put links there, websites even.

How would you like a graphical representation that shows you the visitors to your site, what country, state, and city they surfed in from.  Oh, how about keywords.  If someone searches a keyword and lands on your site, you would want to know right?

Enter Google Analytics

Google Analytics shows you how people found your site, how they explored it, and how you can enhance their visitor experience.   It is free to anyone who wishes to use it.  Oh, it’s limited to 5 million pageviews a month.  If you have this problem you have a busy WHS!  You will need a Google account to sign up for Analytics.  Visit here to get started.

Getting Started

After you have signed up for a Google account and used this account to sign up for Analytics it’s very easy to get started.

image

Enter the name of your domain, i.e., yourservername.homeserver.com.  Click Finish and Google you will be taken to a page that has the code you need for the rest of this process.   You will need to place this code snippet in every page that you wish to be tracked by Analytics.

image

This is the screen you will see that contains the tracking code.  Right click in the box and “Copy” the text for the next steps.  This code snippet will contain your original tracking ID.  It is a code like: UA-1234567-8.  This code ties the site back to the Google Analytics ID.  Click Finish again and you are done on the Google Analytics site.

I recommend creating a new text file on your desktop or in your WHS shares and paste this code snippet and save it.  This way you don’t have to go hunting the code for every webpage you would like to put it in.  Inevitably you will use copy/paste and clear the snippet from your clipboard without even thinking about it.

Placing the Google Analytics code into your WHS Website

If you are not comfortable with Remote Desktop or viewing HTML code you should probably get some help at this point.  Mistakes in this area could render your Remote Access Website inoperable.  Proceed with caution and at your own risk!

Log in to your Windows Home Server via Remote Desktop.  Click Start, My Computer, and then the C: drive.

Locate the Inetpub directory.

image

The page that greets you when you initiate a Remote Access session is found in the “home” directory.  You probably want to track this page and see how much traffic is coming to your Remote Access page.

In the “home” directory locate the file, “default.aspx.”  This is the file we are going to edit.  It’s a good idea to make a backup copy of this file before you edit it.  Right click it and select Copy.  Right click in explorer and click paste.  You will now see your backup copy.

image

This is the HTML editing portion.  See the warning above!

Rick click “default.aspx.” file and click Edit.

Scroll down to the bottom of this file and locate the </body> tag.

image

Go back to the text file you created that contains your Google Analytics code snippet.  Select all, and copy.  Make sure you get it all.

In the default.aspx file you have located the </body> tag.  Click right before the leading < and paste in the Analytics code.  Check to make sure the pasted code did not overwrite existing code or get put in the wrong place.  It might not be lined up nicely but it will work.

image

Notice in this image that the end of the tracking script comes right before the end of body.

</script></body> If yours looks any different Click Edit, Undo and try again.

Click Save!

Tracking Whiist Sites

Whiist is a great website management Add-In for Windows Home Server.  I highly recommend it.  With Whiist you can create a website or a photo album that can be accessed from the Internet.  The Add-In allows you choose the directory in which you place your website.  I put mine in the Public Share on my WHS.  I created a folder called Websites and that’s where I put all my public sites which are hosted on my WHS.

You can also add links to your Remote Access landing page.  I usually add a link to my newly created photo albums so I can get to them directly from my Remote Access page.  Put your favorite links up as well.  For more information on Whiist click here.

Navigate to the folder where your Whiist websites are and simply add the Google code snippet as described above.

Back to Google Analytics

Open a browser and navigate to your WHS page.  Make sure that it looks ok.  This should also send information to Analytics and the Tracking Status should change to receiving data.

It may take up to 24 hours but you can always return to the Analytics setup and have Google look for the code manually.  Once it’s found it you will see a checkmark on the Tracking Status.

Now you need to wait another 24 hours or so for data to come in.  Access your remote page and then come back the next day to see if you have any hits beyond what you have generated.  Here is where the fun part starts!

image

In Analytics click View Report to see your data.  You will have a ton of data at your fingertips.  Click the Map Overlay to see where your traffic is coming from.  It’s probably all generated by you but if your sharing your WHS with others you can see exactly when they accessed your server.

image

Wordpress and other blogging software have plug-ins that do all this work automatically.  Wouldn’t it be cool if this could be wrapped up in a WHS Add-In?  Simply paste your Analytics code into the add-in and it does the rest!

I’m not a coder so there could possibly be some improvements in my methods.  If you are good at this stuff let me know if you seem room for improvement.  If this article helped you please comment!

by:  David McCabe, Windows Home Server MVP 2009

Originally Posted – May 1st, 2009

Popularity: 13% [?]

No related posts.

Comments

2 Responses to “How to track web visitors on your Windows Home Server using Google Analytics”

Trackbacks

Check out what others are saying about this post...
  1. [...] how to add Google Analytics to your Windows Home Server web pages.  You will want to refer to the Google Analytics post for all the real details and a step-by-step method showing you how to add this tracking mechanism [...]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes