Skip to content

Instantly share code, notes, and snippets.

@tzookb tzookb/app.js
Created Aug 24, 2016

Embed
What would you like to do?
mixpanel in vue.js component
let componenet = require('./componenet');
Vue.app ( stuff );
//this code is packaged using browserify
let Vue = require('vue');
let mixpanelMng = require('mixpanel-init');
module.exports = Vue.extend({
template: `
<div @click="mixpanelTrack()">
dont care what is here
</div>
`,
created: function() {
//this code runs as soon as this componenet is rendered
//this event is sent successfully
mixpanelMng.track('share box');
//this event is sent successfully
mixpanel.track('share box');
},
methods: {
mixpanelTrack: function() {
//this happens when user clicks soething
//this event is sent successfully, but dont get logged inside the Mixpanel admin
//so I get no error, but I can not see this in the admin
mixpanelMng.track('share box close');
//but, when I use the global mixpanel variable
//it seems to be the same, but now it is recorded in to the mixpanel admin
mixpanel.track('share box close');
}
}
});
let serverConfig = require('./server-config');
mixpanel.init(serverConfig.mixpanelToken);
module.exports = mixpanel;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.