- Built in tracking image handler
- API usage
- Single page view usage
- Single page view with image usage
- Event tracking
As this project is still in beta, i am only going to support page views for this release, but events and transactions are coming very soon. Additionally, it is lacking any testing, so this will come very soon too.
Potential scenarios where this library can come in handy:
- 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.
Download Version 1.2
Built in tracking image handler
<img src="/tracker.asmx?domain=mydomain.com&pagetitle=My%20Page%20Title&url=/my-page.aspx" />
Easy to use, simple API
To log a page view is very simple
Simple page view usage:
If you simply want to log a page view, create a page view object and track it.
GooglePageView pageView = new GooglePageView("My page title", "www.mydomain.com", "/my-page-url.html"); TrackingRequest request = new RequestFactory().BuildRequest(pageView); GoogleTracking.FireTrackingEvent(request);
Page view tracking with image usage (log with GA and stream /spacer.gif)
If you want to track a page view and then stream an spacer gif.
GooglePageView pageView = new GooglePageView("My page title", "www.mydomain.com", "/my-page-url.html"); GoogleTracking.TrackPageViewWithImage(HttpContext.Current, pageView);
Logging events is just as easy
int? eventValue = 100; GoogleEvent googleEvent = new GoogleEvent("mydomain.com", "Event Category", "Event Action", "Event Label", eventValue); TrackingRequest request = new RequestFactory().BuildRequest(googleEvent, HttpContext.Current); GoogleTracking.FireTrackingEvent(request);
Simply download the library, reference the DLL GaDotNet.Common in your application, set your Google Analytics Account code in the app settings of your web.config or app.config and you’re done.
<appSettings> <!-- Google Analytics Account code (in format UA-XXXXXX-X) --> <add key="GoogleAnalyticsAccountCode" value="UA-599999-9"/> </appSettings>