Joined February 2015
·

Monty

Paris
·
·

Posted to Emberjs and Mixpanel Route visits over 1 year ago

How do you make code look good on coderwall? :/

Posted to Emberjs and Mixpanel Route visits over 1 year ago

Thanks for the post but one thing is that it ended up sending multiple events for nested routes. I ended up using this initializer

export function initialize(container) {
var router = container.lookup('router:main');
router.on('didTransition', function() {
var page = this.get('url');
if (!page) {
var loc = window.location;
page = loc.hash ? loc.hash.substring(1) : loc.pathname + loc.search;
}

mixpanel.track("visit", {pageName: page});

});
}

export default {
name: 'mixpanel',
initialize: initialize
};

Achievements
1 Karma
0 Total ProTip Views