I\'m attempting to make use of Mixpanel event tracking in a single page site based on Backbone.js and require.js.
Looking at the snippet that Mixpanel provide for cut-an
This worked for me. Place your mixpanel snippet in your js/lib directory named mixpanel-snippet.js.
In your app.js add the following shim to require.config:
'mixpanel-snippet': {
exports: 'mixpanel'
}
In your require function add 'mixpanel-snippet' to the required array and initialize mixpanel:
require(['jquery', 'backbone', 'app/router', 'mixpanel'], function ($, Backbone, Router) {
var router = new Router();
Backbone.history.start();
mixpanel.init(key);
mixpanel.track("Landed on Start up Page");
});
I can provide a full app.js example if it would help but this should get your started. Let me know if this works.