ember-metrics
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25771
241