Skip to content

Instantly share code, notes, and snippets.

@ttrefren
Created November 25, 2009 03:43
Show Gist options
  • Select an option

  • Save ttrefren/242453 to your computer and use it in GitHub Desktop.

Select an option

Save ttrefren/242453 to your computer and use it in GitHub Desktop.
// Track a page load. Very simple.
mpmetrics.track("Page load");
// Track a user that plays a game. We include the genre and game title.
mpmetrics.track('Play game', {'genre': 'action', 'title': 'Tomb Raider'});
// Track the first step of a signup funnel.
mpmetrics.track_funnel("Signup", 1, "Hit landing page", {'from': 'google'});
// Register some properties to include with all events sent, so you don't have
// to include them every time.
mpmetrics.register({'user type': 4, 'account age': 234});
// Register some properties to include with only funnel events
mpmetrics.register({'origin': 'Google'}, "funnels");
// Register properties *only* if they have not been registered before
mpmetrics.register_once({'origin': 'Google'});
// Register a funnel
mpmetrics.register_funnel("Signup", ["splash", "signup form", "complete signup"]);
// Identify a user for all future events
mpmetrics.identify("unique string");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment