Wednesday 27 November 2013

Google Analytics using C#, without using JavaScript

In case if you want to handle GA tracking using C# instead of using JavaScript here is a solution.

Click here to see the solution

The solution has C# code that does two things

  1. Formats http://www.google-analytics.com/__utm.gif url and querystring
  2. Make a request to www.google-analytics.com using System.Net.WebRequest

This can be handy in following scenarios.
  • When you want to log page views for things that normally' can’t – like web service calls, win forms application usage etc.
  • When you replace page views with Ajax calls, but still want to log the Ajax action as a second page view.
  • If you want to use Google analytics to log non-website information, such as offline transactions, product catalogue statistics or store purchases.

No comments:

Post a Comment