Analytics libraries

One liners to use analytics librairies on your website

A cheatsheet by @rstacruz|Refreshed over 3 years ago.Refresh|View source on Github

Mixpanel

Mixpanel

mixpanel.identify('284');
mixpanel.people.set({ $email: 'hi@gmail.com' });
mixpanel.register({ age: 28, gender: 'male' }); /* set common properties */

Google Analytics’s analytics.js

Google Analytics’s analytics.js

ga('create', 'UA-XXXX-Y', 'auto');
ga('create', 'UA-XXXX-Y', { userId: 'USER_ID' });
ga('send', 'pageview');
ga('send', 'pageview', { 'dimension15': 'My custom dimension' });