Skip to content

Instantly share code, notes, and snippets.

Avatar

AK ak--47

View GitHub Profile
@ak--47
ak--47 / vanillaTrackStuff.js
Created Jul 19, 2020
Mixpanel .track() with no dependencies
View vanillaTrackStuff.js
//a vanilla implementation of .track()
//docs: https://developer.mixpanel.com/docs/http
//by AK
function trackStuff(uuid, eventName, props, token) {
//the mixpanel data model
let spec = {
"event": eventName,
"properties": {
// these two properties are required!
@ak--47
ak--47 / exampleSPAimplementations.js
Last active Jul 19, 2020
An Example of Mixpanel inside a SPA
View exampleSPAimplementations.js
//an example of Mixpanel implemented in a frameworkless SPA
//docs: https://developer.mixpanel.com/docs/javascript
//by AK
const app = {
init: function() {
console.log("app init!");
this.cacheDOM();
this.bindEvents();
this.authUser().then((user) => {
View genesis_public_key
04875712bf99ebf077b759b3a06b370be4929115e7eb14737e87a91bc7a7542f6647010bfb99d52c788299ff6100c61eb98b731ea05482f44a9387f3206f1e8cae;jasonseiler
@ak--47
ak--47 / mixpanel.js
Last active Aug 4, 2016
Ximble: client side mixpanel tracking (example)
View mixpanel.js
$(document).ready(function(){
//initialize everyone as an unknown user
mixpanel.register({"known-user":false});
//build a list of properties to send with the page View event
var pageProps = {"page name":$(document).attr('title')}
//sends the page load event; a response of 1 on the XHR request means mixpanel got the data
mixpanel.track('Page View', pageProps)
})
You can’t perform that action at this time.