mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +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 {DOCUMENT} from '@angular/common';
|
||||
|
||||
/**
|
||||
* Set up Google Analytics on the client side.
|
||||
* See: {@link addTrackingIdToPage}.
|
||||
*/
|
||||
@Injectable()
|
||||
export class GoogleAnalyticsService {
|
||||
|
||||
@@ -14,6 +18,12 @@ export class GoogleAnalyticsService {
|
||||
@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 {
|
||||
this.configService.findByPropertyName('google.analytics.key').pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
|
Reference in New Issue
Block a user