Emberfire provies a mixin at emberfire/mixins/analytics-route
which will send data to Google Analytics on Route changes and track the currently active route.
If you want to track all routes just extend your application route (app/routes/application.js
) like so:
import AnalyticsRouteMixin from 'emberfire/mixins/analytics-route';
import Route from '@ember/routing/route';
export default Route.extend(AnalyticsRouteMixin);
import { inject as service } from '@ember/service';
...
firebaseApp: service('firebase-app'),
...
const analytics = await firebase.analytics();
analytics.logEvent("some_event", { ... });
import PerformanceRouteMixin from 'emberfire/mixins/performance-route';
import Route from '@ember/routing/route';
export default Route.extend(PerformanceRouteMixin);
import { inject as service } from '@ember/service';
...
firebaseApp: service('firebase-app'),
...
const perf = await firebase.performance();
const trace = perf.trace("some_event");
trace.start();
...
trace.stop()