Coder Social home page Coder Social logo

sibsfinx / ember-cli-mixpanel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mszoernyi/ember-cli-mixpanel

0.0 2.0 0.0 16 KB

Ember CLI addon for tracking users activities via Mixpanel

License: MIT License

JavaScript 78.74% HTML 20.93% CSS 0.33%

ember-cli-mixpanel's Introduction

Ember CLI addon for Mixpanel

An Ember-CLI addon that eases integration between your application and Mixpanel. This is a close port of rahim's ember-segmentio.

Usage

Add ember-cli-mixpanel as a dependency to your package.json or just run ember install:addon ember-cli-mixpanel.

There are two manual steps

  • Extend your Router with tracking_mixin.js.
  • Add a {{content-for 'mixpanel'}} to your index.html to include the mixpanel script.

Configuration

There are some options available to configure the mixpanel addon. Only token is a mandatory option otherwise

mixpanel: {
  enabled: false,
  LOG_EVENT_TRACKING: false,
  token: 'b619c413e0d49a362236388a4f5ec679',
  disable_auto_tracking: true // default: false
}

Tracking Page Views

Once included your router will automatically send a page view event to Mixpanel everytime the URL changes. This behavior can be disabled with disable_auto_tracking: true.

Tracking Additional Events

You can track addinional events as well. Let's say we would like to track play events on our controller.

import Ember from 'ember'
import TrackingMixin from './mixin/tracking_mixin'

var VideoController = Ember.Controller.extend(
  TrackingMixin, {

  actions: {
    play: function() {
      // ...
      // this.trackEvent(event, properties, options, callback)
      this.trackEvent('Play video');
      // or
      this.trackEvent('Play video', {
        title: 'Never gonna give you up'
      }
    });
  }
});

The mixin can be applied to any Ember object.

identifyUser, aliasUser

TBD

Logging

For debugging purposes you can enable logging for all events. Events are still send to Mixpanel but you will get an additional output in your console.

Add LOG_EVENT_TRACKING = true|false to your config file

Development

Simple ember-cli addon just follow the documentation :)

ember-cli-mixpanel's People

Contributors

archit avatar ascot21 avatar ember-tomster avatar hollow avatar mszoernyi avatar

Watchers

 avatar  avatar

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.