mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 20:13:07 +00:00
76634: Add documentation
This commit is contained in:
@@ -5,6 +5,10 @@ import {getFirstCompletedRemoteData} from '../core/shared/operators';
|
|||||||
import {isEmpty} from '../shared/empty.util';
|
import {isEmpty} from '../shared/empty.util';
|
||||||
import {DOCUMENT} from '@angular/common';
|
import {DOCUMENT} from '@angular/common';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up Google Analytics on the client side.
|
||||||
|
* See: {@link addTrackingIdToPage}.
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GoogleAnalyticsService {
|
export class GoogleAnalyticsService {
|
||||||
|
|
||||||
@@ -14,6 +18,12 @@ export class GoogleAnalyticsService {
|
|||||||
@Inject(DOCUMENT) private document: Document
|
@Inject(DOCUMENT) private document: Document
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this method once when Angular initializes on the client side.
|
||||||
|
* It requests a Google Analytics tracking id from the rest backend
|
||||||
|
* (property: google.analytics.key), adds the tracking snippet to the
|
||||||
|
* page and starts tracking.
|
||||||
|
*/
|
||||||
addTrackingIdToPage(): void {
|
addTrackingIdToPage(): void {
|
||||||
this.configService.findByPropertyName('google.analytics.key').pipe(
|
this.configService.findByPropertyName('google.analytics.key').pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
|
Reference in New Issue
Block a user