mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
97287: Fix GA page-view requests
This commit is contained in:
@@ -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(
|
||||
|
@@ -20,7 +20,7 @@ export class ViewTrackerComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.angulartics2.eventTrack.next({
|
||||
action: 'pageView',
|
||||
action: 'page_view',
|
||||
properties: {object: this.object},
|
||||
});
|
||||
}
|
||||
|
@@ -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');
|
||||
|
@@ -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
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user