A quick syntax reference for popular client-side web product analytics and tracking libraries.
Mixpanel
mixpanel.identify('284');
mixpanel.people.set({ $email: '[email protected]' });
mixpanel.register({ age: 28, gender: 'male' }); /* set common super properties */
mixpanel.track('Signed Up', {
'Signup Type': 'Referral'
});
See: Mixpanel JavaScript SDK Documentation
Google Analytics (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' });
See the dedicated Google Analytics Legacy APIs Cheat Sheet.