Giter Site home page Giter Site logo

ember-cli-mixpanel-service's Introduction

ember-cli-mixpanel-service

npm version Ember Observer Score Code Climate

This ember-cli addon injects mixpanel into your ember app.

The mixpanel js is injected into the app's index.html. Pageview tracking is by default automatic, no mixins required. The mixpanel service is injected into your apps controllers and routes and is available as this.get('mixpanel').

More on mixpanel at http://www.mixpanel.com

Installation

ember install ember-cli-mixpanel-service

Configuration

This plugin uses the ember-cli project's configuration as defined in config/environment.js.

Add your Mixpanel API token 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'
    }

Configuration Parameters

  • enabled (Default: true): Enable mixpanel tracking
  • autoPageviewTracking (Default: true): Enable automatic pageview tracking
  • pageViewAttribute (Default: url): Use some other attribute available to the router instead of url for pageview tracking
  • attributeOverrides (Default: {}): Configure overrides, if any, for any of the attributes mixpanel stores by default
  • LOG_EVENT_TRACKING (Default: false): Output logging to the console.
  • token (Default: null): Mandatory Mixpanel API token

CORS Content Security Policy

If you use ember-cli-content-security-policy you should add the Mixpanel API to your app's content security policy settings. 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 ..."
      ...
    }

Mixpanel API

pageviews

trackPageView: function(page, overrides = {})

Note: Pageviews are tracked automatically by default, no mixins required. You can override any properties mixpanel stores by default by providing an optional overrides object.

events

trackEvent: function(event, properties, options, callback)

Alias of the mixpanel track function

identify

identify: function(userId, traits, options, callback)

Alias of the mixpanel identify function

alias

alias: function(userId, previousId, options, callback)

Alias of the mixpanel alias function

register

register: function(traits, options, callback)

Alias of the mixpanel register function

peopleSet

peopleSet: function(attributes)

Alias of the mixpanel people.set function

ember-cli-mixpanel-service's People

Contributors

andrewvy avatar balinterdi avatar dasnixon avatar davewasmer avatar elwayman02 avatar ember-tomster avatar jurgenwerk avatar kylenathan avatar romulomachado avatar ryanlabouve avatar tompesman avatar tundal45 avatar walter avatar wireframe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ember-cli-mixpanel-service's Issues

Address Ember.merge deprecation warnings

DEPRECATION: Usage of `Ember.merge` is deprecated, use `Ember.assign` instead. [deprecation id: ember-metal.merge] See http://emberjs.com/deprecations/v2.x/#toc_ember-merge for more details.

More Examples in Readme

I would love to see a few more code examples of how to use this addon in the readme. I think this would help folks who find this addon and are considering using, but might like to see it in context of some code first.

I'm happy to try to work on this if it's of interest?

Alsoβ€” great addon! 🀘

TypeError: Cannot read property 'enabled' of undefined

I just did a fresh install and am getting this message. I referenced closed issue #1 but am still returning a similar error: TypeError: Cannot read property 'enabled' of undefined. Thoughts?

environment
Ember 1.13.2
Ember Cli 0.2.7

package.json

"ember-cli-mixpanel-service": "0.0.8",

config/environment

if (environment === 'production') {
    ENV.APP.dataHost = 'https://api.myhubapp.com';
    ENV.mixpanel = {
      enabled: true,
      LOG_EVENT_TRACKING: false,
      token: 'my_token'
    };

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.