From 1c11b9813c94f7030dd1106ec6b2f022d92c3485 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Mon, 9 Jan 2023 15:59:48 +0100 Subject: [PATCH 1/5] 97287: Fix GA page-view requests --- src/app/statistics/angulartics/dspace-provider.ts | 2 +- .../angulartics/dspace/view-tracker.component.ts | 2 +- src/app/statistics/google-analytics.service.ts | 9 ++++++--- src/modules/app/server-app.module.ts | 9 +++++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/app/statistics/angulartics/dspace-provider.ts b/src/app/statistics/angulartics/dspace-provider.ts index cd1aab94bd..6efa67f92a 100644 --- a/src/app/statistics/angulartics/dspace-provider.ts +++ b/src/app/statistics/angulartics/dspace-provider.ts @@ -24,7 +24,7 @@ export class Angulartics2DSpace { } private eventTrack(event) { - if (event.action === 'pageView') { + if (event.action === 'page_view') { this.statisticsService.trackViewEvent(event.properties.object); } else if (event.action === 'search') { this.statisticsService.trackSearchEvent( diff --git a/src/app/statistics/angulartics/dspace/view-tracker.component.ts b/src/app/statistics/angulartics/dspace/view-tracker.component.ts index 85588aeb97..d12b6c2f69 100644 --- a/src/app/statistics/angulartics/dspace/view-tracker.component.ts +++ b/src/app/statistics/angulartics/dspace/view-tracker.component.ts @@ -20,7 +20,7 @@ export class ViewTrackerComponent implements OnInit { ngOnInit(): void { this.angulartics2.eventTrack.next({ - action: 'pageView', + action: 'page_view', properties: {object: this.object}, }); } diff --git a/src/app/statistics/google-analytics.service.ts b/src/app/statistics/google-analytics.service.ts index 9c5883d183..9d32a61093 100644 --- a/src/app/statistics/google-analytics.service.ts +++ b/src/app/statistics/google-analytics.service.ts @@ -1,7 +1,10 @@ import { DOCUMENT } from '@angular/common'; import { Inject, Injectable } from '@angular/core'; -import { Angulartics2GoogleAnalytics, Angulartics2GoogleTagManager } from 'angulartics2'; +import { + Angulartics2GoogleAnalytics, + Angulartics2GoogleGlobalSiteTag, +} from 'angulartics2'; import { combineLatest } from 'rxjs'; import { ConfigurationDataService } from '../core/data/configuration-data.service'; @@ -19,7 +22,7 @@ export class GoogleAnalyticsService { constructor( private googleAnalytics: Angulartics2GoogleAnalytics, - private googleTagManager: Angulartics2GoogleTagManager, + private googleGlobalSiteTag: Angulartics2GoogleGlobalSiteTag, private klaroService: KlaroService, private configService: ConfigurationDataService, @Inject(DOCUMENT) private document: any, @@ -70,7 +73,7 @@ export class GoogleAnalyticsService { this.document.body.appendChild(libScript); // start tracking - this.googleTagManager.startTracking(); + this.googleGlobalSiteTag.startTracking(); } else { // add trackingId snippet to page const keyScript = this.document.createElement('script'); diff --git a/src/modules/app/server-app.module.ts b/src/modules/app/server-app.module.ts index 17e394ede8..4b51a846f9 100644 --- a/src/modules/app/server-app.module.ts +++ b/src/modules/app/server-app.module.ts @@ -6,7 +6,12 @@ import { ServerModule, ServerTransferStateModule } from '@angular/platform-serve import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { Angulartics2, Angulartics2GoogleAnalytics, Angulartics2GoogleTagManager } from 'angulartics2'; +import { + Angulartics2, + Angulartics2GoogleAnalytics, + Angulartics2GoogleGlobalSiteTag, + Angulartics2GoogleTagManager +} from 'angulartics2'; import { AppComponent } from '../../app/app.component'; @@ -63,7 +68,7 @@ export function createTranslateLoader(transferState: TransferState) { useClass: AngularticsProviderMock }, { - provide: Angulartics2GoogleTagManager, + provide: Angulartics2GoogleGlobalSiteTag, useClass: AngularticsProviderMock }, { From 357525e68ac830b33062c70a73db28fc1478ab42 Mon Sep 17 00:00:00 2001 From: Michael Spalti Date: Mon, 9 Jan 2023 10:32:49 -0800 Subject: [PATCH 2/5] Ignore IP authentication method in login component. lint fix using enum Simplified assignment. --- src/app/shared/log-in/log-in.component.html | 2 +- src/app/shared/log-in/log-in.component.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/shared/log-in/log-in.component.html b/src/app/shared/log-in/log-in.component.html index 6e4685a07b..36f7034f4d 100644 --- a/src/app/shared/log-in/log-in.component.html +++ b/src/app/shared/log-in/log-in.component.html @@ -1,6 +1,6 @@