GAhelper for Google Analytics
ISAPI Filter or .NET HttpModule for IIS
Easily add Google Analytics to ALL your web pages in less than five minutes

Installing GAhelper on IIS 7

Download GAhelper, don't forget to license your copy if you find it useful.

Upload to /Bin
ASP.NET uses a folder named /bin to find needed assemblies. So just upload the .dll file to this bin folder. You can also install it into the GAC on your server, though if you don't know what a GAC is, you probably don't want to do that.

Edit Web.Config
GAhelper comes with a Web.Config file, but you don't want to just upload it as is. First, replace the UA-XXXXXX-X value with your Google Analytics ID, referenced in the previous step. Then copy each section into the corresponding section in your web.config. If you have a web.config but don't understand how to edit it, it should be standard XML and the schema is available online.

The web.config file belongs in the root of your website, it must be named web.config as that is how ASP.NET and IIS look for it.

There is a preCondition attributue in the config file that you may wish to change to suit your configuration. There is also a scriptProcessor attribute that you would change if you wanted to run against the 64 bit dll or .NET version 4, for example.

More information on the web.config


Classic Pipeline File Types
You don't need to register every file type for GAhelper because practically speaking, there is only a handful of types you'll ever have tracking code on. These probably include *.html *.htm and might also include other types. Be aware though that PHP, Perl and other scripting languages need to be handled appropriately and you can't just remove their PHP handler, for example. The IIS 7 classic pipeline mode routes requests much like IIS 6 does, but these routings can be configured with you web.config file, so you don't need to log on to the server to do it. The <handlers> element in web.config deals with this.

Managed Pipeline File Types

The IIS 7 managed pipeline mode by default routes all requests through ASP.NET, making configuration that much easier.





Have a Problem?
If Analytics code doesn't show up in the source code of your browser, try clearing your cache. If you have problems please review these instructions. If for some reason the filter causes problems with your site, simply remove the changes to your web.config file.



Installation: Step 2/2


Regarding IIS 6
IIS 6 does not use the web.config file to store configuration information, so unfortunately you have to log on to the server to assign .html or .htm files to be handled by ASP.NET - a prerequisite for using the HttpModule.

This Microsoft article covers these mapping issues in detail.

Regarding IIS 7 64 Bit
64 bit IIS application pools don't like 32 bit assemblies, this fixes that:

  1. Right click on the Application Pool and select “Advanced Settings…” or select the same from the Actions pane after selecting the Application pool
  2. Change the “Enable 32-bit Applications” to True
  3. Click OK

Congratulations
You will have Google Analytics setup for every page on your website without having to change a single page on your site. Please remember to license your copy of GAhelper.


New Documentation Warning
The .NET version is newer and so are these instructions. If they leave you with questions or you think we got something wrong, please contact us.