Code Monkey home page Code Monkey logo

garlic's Introduction

##Garlic Google Analytics Reporting Library In C#

Google Analytics is a powerful tool for analyzing traffic patterns and conversion on a website. With Garlic, it can become a powerful tool for analyzing usage of any application written in .Net, be it an MsMVC web application or a WPF desktop application.

Use Garlic

The Garlic.Sample.WPF projects contains a simple WPF application using the Caliburn.Micro MVVM framework showing how to use Garlic to report analytics data for your desktop application.

Create an analytics session

var session = new AnalyticsSession(Domain, GACode);

Optionally set session level custom variables

session.SetCustomVariable(
  1,            // variable slot (1 - 5)
  "UserName",   // key
  "dracula");   // value

Create a page view request and wire it up to screen activation events

var page = session.CreatePageViewRequest(
  "/",          // path
  "Home page"); // page title

// extension method for wiring a page view request to a Caliburn.Micro 
// screen (not included)
page.Track(screen); 

// or send page views manually
page.Send();

Optionally set page level custom variables (page level variables override session variables in the same slot)

page.SetCustomVariable(
  2,            // variable slot (1 - 5) 
  "usertype",   // key
  "member");    // value

Submit events

page.SendEvent("category", "action", "label", "value");

or timing data

page.SendTiming("category", "variable", 1000 /* time in millis */, "label");

start a timing to be submitted later

var timing = page.StartTiming("category", "variable", "label");
//Suck some blood, eat some rats, whatever fancies you
timing.Finish(); //Sends the timing information

Get Garlic

Garlic is available as a NuGet package and can be installed via the NuGet Package Manager:

PM> Install-Package Garlic

Known Issues

  1. Garlic does not report accurate color depth, screen resoluation, view port size, or language
  2. There's no way to report page load times

Notable Gotchas

  • Each Session represents a unique visit and each Page represents a page view within that visit.
  • Source will always be (direct) and medium will always be (none)
  • Browser and OS information is never sent
  • All users are considered "Returning Visitors"

garlic's People

Contributors

dustyburwell avatar dynajoe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.