Adds Google Analytics

This commit is contained in:
Aaron Louie 2020-06-01 23:15:11 -04:00
parent 930c4d219a
commit cb5b76c92f
4 changed files with 13 additions and 5 deletions

6
package-lock.json generated
View File

@ -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",

View File

@ -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"

View File

@ -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() {

View File

@ -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 => {