Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit 8a96469

Browse files
committed
Analytics app name/version overrides
1 parent a00390d commit 8a96469

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

addon/mixins/analytics-route.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ import { inject as service } from '@ember/service';
33
import { get } from '@ember/object';
44

55
export default Mixin.create({
6+
analyticsAppName: null as string|null,
7+
analyticsAppVersion: null as string|null,
68
firebaseApp: service('firebase-app'),
79
router: service('router'),
810
init() {
911
this._super(...arguments);
1012
const router = get(this, 'router');
1113
router.on('routeDidChange', () => {
1214
const firebase = get(this, 'firebaseApp');
13-
const app_name = "Ember App";
14-
const screen_name = router.currentRouteName || '';
15+
const app_name = get(this, 'analyticsAppName') || 'Ember App';
16+
const app_version = get(this, 'analyticsAppVersion') || undefined;
17+
const screen_name = router.currentRouteName || undefined;
1518
const url = router.currentURL;
1619
firebase.analytics().then(analytics => {
17-
analytics.logEvent("screen_view", { app_name, screen_name, url });
20+
analytics.logEvent("screen_view", { app_name, screen_name, url, app_version });
1821
});
1922
})
2023
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import AnalyticsRouteMixin from 'emberfire/mixins/analytics-route';
22
import Route from '@ember/routing/route';
33

4-
export default Route.extend(AnalyticsRouteMixin);
4+
export default Route.extend(AnalyticsRouteMixin, {
5+
analyticsAppName: 'Something, something, app',
6+
analyticsAppVersion: '0'
7+
});

0 commit comments

Comments
 (0)