Skip to content
Snippets Groups Projects
Commit 536cb02c authored by jvanboxtel@wisc.edu's avatar jvanboxtel@wisc.edu
Browse files

ROENROLL-1746 ga career tracking

parent b8e9b4a7
No related branches found
No related tags found
No related merge requests found
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 });
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment