This ember-cli addon injects mixpanel into your ember app.
The mixpanel js is injected into the app's index.html. Pageview tracking is automatic, no mixins required. The mixpanel service is injected into your apps controllers and routes and is available as this.mixpanel
.
This is close port of https://github.com/remerge/ember-cli-mixpanel but refactored as a service.
More on mixpanel at http://www.mixpanel.com
ember install:addon ember-cli-mixpanel-service
This plugin uses the ember-cli project's configuration as defined in config/environment.js
.
Add your typekit kitId to config/environment.js
and you're good to go. A couple more params below
// environment.js
ENV.mixpanel = {
enabled: false,
LOG_EVENT_TRACKING: false,
token: 'abcd123456789'
}
enabled
(Default:true
): Enable mixpanel trackingLOG_EVENT_TRACKING
(Default:false
): Output logging to the console.token
(Default:null
): Mandatory mixpanel api token
You should add the Mixpanel API to your app's content security policy. To do this add api.mixpanel.com to the 'connect-src' key in the ENV.contentSecurityPolicy hash as below:
// environment.js
ENV.contentSecurityPolicy = {
'connect-src': "'self' api.mixpanel.com ..."
...
}
trackPageView: function(page)
Note: Pageviews are tracked automatically, no mixins required.
trackEvent: function(event, properties, options, callback)
Alias of the mixpanel track
function
identify: function(userId, traits, options, callback)
Alias of the mixpanel identify
function
alias: function(userId, previousId, options, callback)
Alias of the mixpanel alias
function
register: function(traits, options, callback)
Alias of the mixpanel register
function
unregister: function(property)
Alias of the mixpanel unregister
function
peopleSet: function(attributes)
Alias of the mixpanel people.set
function