Socket
Socket
Sign inDemoInstall

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.1.3 to 0.1.4

2

addon/services/metrics.js

@@ -100,3 +100,3 @@ import Ember from 'ember';

const localAdapter = container.lookupFactory(`metrics-adapter:${dasherizedAdapterName}`);
const adapter = availableAdapter ? availableAdapter : localAdapter;
const adapter = localAdapter ? localAdapter : availableAdapter;

@@ -103,0 +103,0 @@ return adapter;

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

@@ -5,0 +5,0 @@ "directories": {

@@ -28,18 +28,29 @@ # ember-metrics

In order to use the addon, you must first [configure](#configuration) it, then inject it into any Object registered in the container that you wish to track. For example, you can call a `trackPage` event across all your analytics services like so:
In order to use the addon, you must first [configure](#configuration) it, then inject it into any Object registered in the container that you wish to track. For example, you can call a `trackPage` event across all your analytics services whenever you transition into a route, like so:
```js
// app/router.js
import Ember from 'ember';
import config from './config/environment';
export default Ember.Route.extend({
metrics: Ember.inject.service(),
activate() {
const metrics = get(this, 'metrics');
const Router = Ember.Router.extend({
location: config.locationType,
metrics: inject.service(),
metrics.trackPage({
title: 'My Awesome App'
didTransition() {
this._super(...arguments);
this._trackPage();
},
_trackPage() {
Ember.run.scheduleOnce('afterRender', this, () => {
const page = document.location.href;
const title = Ember.getWithDefault(this, 'routeName', 'unknown');
Ember.get(this, 'metrics').trackPage({ page, title });
});
}
});
export default Router.map(/* ... */);
```

@@ -46,0 +57,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