From 536cb02cced4547864e75c4fe14bc67bc2d96335 Mon Sep 17 00:00:00 2001
From: "jvanboxtel@wisc.edu" <jvanboxtel@wisc.edu>
Date: Wed, 22 May 2019 14:12:12 -0500
Subject: [PATCH] ROENROLL-1746 ga career tracking

---
 src/app/shared/services/google-analytics.service.ts | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/app/shared/services/google-analytics.service.ts b/src/app/shared/services/google-analytics.service.ts
index 17f5f5d..381afc6 100644
--- a/src/app/shared/services/google-analytics.service.ts
+++ b/src/app/shared/services/google-analytics.service.ts
@@ -1,3 +1,4 @@
+import { ConstantsService } from '@app/degree-planner/services/constants.service';
 import { Injectable } from '@angular/core';
 import { Router, NavigationEnd } from '@angular/router';
 import { environment } from '../../../environments/environment';
@@ -5,15 +6,21 @@ declare var ga: Function; // <-- Here we declare GA variable
 
 @Injectable()
 export class GoogleAnalyticsService {
-  constructor(router: Router) {
+  constructor(router: Router, constants: ConstantsService) {
     if (!environment.production) {
       return;
     }
+    const studentDataCareer = constants.getStudentInfo().primaryCareer;
+    const careerAndAcademicLevel = studentDataCareer
+      ? studentDataCareer.careerCode +
+        '-' +
+        studentDataCareer.academicLevelDescription
+      : 'None';
 
     router.events.subscribe(event => {
       if (event instanceof NavigationEnd) {
         ga('set', 'page', '/degree-planner');
-        ga('send', 'pageview');
+        ga('send', 'pageview', { careerAndLevel: careerAndAcademicLevel });
       }
     });
   }
-- 
GitLab