From cb5b76c92f1c600ef5a1b0fbb8c5a9e52568af36 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Mon, 1 Jun 2020 23:15:11 -0400 Subject: [PATCH] Adds Google Analytics --- package-lock.json | 6 +++--- package.json | 2 +- src/app/app.component.ts | 7 ++++++- src/app/navbar/navbar.component.ts | 3 +++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index aae9ad2..92ce583 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12299,9 +12299,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.231", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.231.tgz", - "integrity": "sha512-89kkRnTy3Ix9bawDXt0uddMtjGDj7VacARa78PEHR3CSYt/dWTsqAC7x4SJr3IdElzgvPDh9yZqxAUuciMHtLg==" + "version": "0.0.234", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.234.tgz", + "integrity": "sha512-v0IznXGlVaznpIE5jLVNqNWeIr4I22oU2E1yyayAc4eCYC5P8+KnvJYKdW/sUBfH9jKRKUlseMK3jSX7Tt/IPw==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index 9a3c489..23c450c 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "0.0.231", + "sartography-workflow-lib": "0.0.234", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a1d377a..8503dc1 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,6 @@ import {Component} from '@angular/core'; import {ApiService} from 'sartography-workflow-lib'; +import {GoogleAnalyticsService} from 'sartography-workflow-lib/lib/services/google-analytics.service'; @Component({ selector: 'app-root', @@ -9,7 +10,11 @@ import {ApiService} from 'sartography-workflow-lib'; export class AppComponent { title = 'CR Connect Configuration'; - constructor(private apiService: ApiService) { + constructor( + private apiService: ApiService, + private googleAnalyticsService: GoogleAnalyticsService + ) { + this.googleAnalyticsService.init(); } get isSignedIn() { diff --git a/src/app/navbar/navbar.component.ts b/src/app/navbar/navbar.component.ts index 7e1af1c..03219a6 100644 --- a/src/app/navbar/navbar.component.ts +++ b/src/app/navbar/navbar.component.ts @@ -1,6 +1,7 @@ import {Component, Inject, OnInit} from '@angular/core'; import {Router} from '@angular/router'; import {ApiService, AppEnvironment, isSignedIn, User, UserParams} from 'sartography-workflow-lib'; +import {GoogleAnalyticsService} from 'sartography-workflow-lib/lib/services/google-analytics.service'; interface NavItem { path?: string; @@ -25,6 +26,7 @@ export class NavbarComponent { private router: Router, private api: ApiService, @Inject('APP_ENVIRONMENT') private environment: AppEnvironment, + private googleAnalyticsService: GoogleAnalyticsService ) { this._loadUser(); this.title = environment.title; @@ -37,6 +39,7 @@ export class NavbarComponent { private _loadUser() { if (isSignedIn()) { this.api.getUser().subscribe(u => { + this.googleAnalyticsService.setUser(u.uid); this.user = u; this._loadNavLinks(); }, error => {