I’ve been using Google Analytics for a while now, both for this blog and my projects site, and as many others I think the service is great.
I stumbled upon a solution by Remy Sharp (see here), in the form of a plugin written in PHP for the popular WordPress blog engine, and with his permission I ported it to a .NET solution.
So what does this project do?
It generates a snippet that includes not only the regular Google Analytics script, but also a small
<NOSCRIPT> tag with an image loaded from Google’s servers, with parameters about the current request.
The project includes three basic components:
Generates the snippets, either separately (for the NOSCRIPT, and the script), or the entire snippet
ASP.NET MVC Html Helpers
<%= Html.GoogleAnalytics("UA-xxxxxx-x"/* Google Analytics Account ID */)%>
- ASP.NET Web Forms
<GoogleAnalytics:GAControl ID="GAControlID" runat="server" GoogleAnalyticsID="UA-xxxxxx-x" />
There’s also a small sample site, with both ASP.NET MVC and ASP.NET Web forms samples.
Where can I get it?
Visit the project page for more details.