Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-metrics

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-metrics - npm Package Compare versions

Comparing version 0.5.3 to 0.6.0

.npmignore

12

addon/metrics-adapters/mixpanel.js

@@ -9,3 +9,4 @@ import Ember from 'ember';

$,
get
get,
merge
} = Ember;

@@ -50,3 +51,3 @@ const {

trackEvent(options ={}) {
trackEvent(options = {}) {
const compactedOptions = compact(options);

@@ -63,2 +64,9 @@ const { event } = compactedOptions;

trackPage(options = {}) {
const event = { event: 'page viewed' };
const mergedOptions = merge(event, options);
this.trackEvent(mergedOptions);
},
alias(options = {}) {

@@ -65,0 +73,0 @@ const compactedOptions = compact(options);

/* jshint node: true */
'use strict';
var Funnel = require('broccoli-funnel');
var path = require('path');
function normalize(name) {
if (typeof name === 'string') {
name = path.basename(name, '.js');
return name.replace(/([a-z](?=[A-Z]))/g, '$1-').toLowerCase();
}
}
function uniqueStrings(arr) {
var out = [];
var dict = {};
for (var i=0;i<arr.length;i++) {
var obj = arr[i];
if (typeof obj === 'string' && !dict[obj]) {
out.push(obj);
dict[obj] = true;
}
}
return out;
}
function getEach(arr, propName) {
var out = [];
for (var i=0;i<arr.length;i++) {
var obj = arr[i];
if (typeof obj === 'object' && obj[propName]) {
out.push(obj[propName]);
}
}
return out;
}
module.exports = {
name: 'ember-metrics'
name: 'ember-metrics',
included: function(app) {
this._super.included.apply(this, arguments);
var config = this.app.project.config(app.env) || {};
var addonConfig = config[this.name] || {};
var discovered = ['base'];
if (addonConfig.includeAdapters) {
discovered = discovered.concat(addonConfig.includeAdapters);
}
if (config.metricsAdapters) {
discovered = discovered.concat(getEach(config.metricsAdapters, 'name'));
}
this.whitelisted = uniqueStrings(discovered.map(normalize));
},
treeForAddon: function() {
// see: https://github.com/ember-cli/ember-cli/issues/4463
var tree = this._super.treeForAddon.apply(this, arguments);
return this.filterAdapters(tree, new RegExp('^modules\/' + this.name + '\/metrics\-adapters\/', 'i'));
},
filterAdapters: function(tree, regex) {
var whitelisted = this.whitelisted;
return new Funnel(tree, {
exclude: [function(name) {
return regex.test(name) && whitelisted.indexOf(path.basename(name, '.js')) === -1;
}]
});
}
};

2

LICENSE.md
The MIT License (MIT)
Copyright (c) 2015 Lauren Elizabeth Tan
Copyright (c) 2016 Lauren Elizabeth Tan

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "ember-metrics",
"version": "0.5.3",
"version": "0.6.0",
"description": "Send data to multiple analytics integrations without re-implementing new API",

@@ -32,11 +32,11 @@ "directories": {

"broccoli-asset-rev": "^2.2.0",
"ember-cli": "1.13.13",
"ember-cli": "2.3.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-dependency-checker": "^1.1.0",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-ic-ajax": "0.2.4",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.0.4",
"ember-cli-qunit": "^1.2.1",
"ember-cli-release": "0.2.8",
"ember-cli-sri": "^1.2.0",
"ember-cli-sri": "^2.0.0",
"ember-cli-uglify": "^1.2.0",

@@ -46,4 +46,7 @@ "ember-disable-prototype-extensions": "^1.0.0",

"ember-export-application-global": "^1.0.4",
"ember-load-initializers": "^0.5.0",
"ember-resolver": "2.0.3",
"ember-sinon": "0.3.0",
"ember-try": "~0.0.8"
"ember-try": "^0.1.2",
"loader.js": "^4.0.0"
},

@@ -58,5 +61,7 @@ "keywords": [

"google tag manager",
"mixpanel"
"mixpanel",
"piwik"
],
"dependencies": {
"broccoli-funnel": "^1.0.1",
"ember-cli-babel": "^5.1.5",

@@ -63,0 +68,0 @@ "ember-cli-htmlbars": "^1.0.1",

@@ -30,2 +30,7 @@ # ember-metrics

- `key`: [Segment key](https://segment.com/docs/libraries/analytics.js/quickstart/)
1. `Piwik`
- `piwikUrl`: [Tracker URL](http://developer.piwik.org/guides/tracking-javascript-guide)
- `siteId`: [Site Id](http://developer.piwik.org/guides/tracking-javascript-guide)
1. `KISSMetrics` (WIP)

@@ -81,2 +86,10 @@ 1. `CrazyEgg` (WIP)

{
name: 'Piwik',
environments: ['production'],
config: {
piwikUrl: 'http://piwik.my.com',
siteId: 42
}
},
{
name: 'LocalAdapter',

@@ -246,2 +259,16 @@ environments: ['all'], // default

Since ember-metrics now automatically removes all unused adapters, it's also important to force the inclusion of the adapter via `config/environment`. NOTE: If the adapter is already defined in the `metricsAdapters` array of `config/environment` then this step is not necessary.
```js
// config/environment
module.exports = function(environment) {
var ENV = {
'ember-metrics': {
includeAdapters: ['google-analytics']
}
};
return ENV;
```
## Writing Your Own Adapters

@@ -248,0 +275,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc