1 | "use strict";
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
10 | exports.MultiAnalytics = void 0;
|
---|
11 | /**
|
---|
12 | * Analytics implementation that reports to multiple analytics backend.
|
---|
13 | */
|
---|
14 | class MultiAnalytics {
|
---|
15 | constructor(_backends = []) {
|
---|
16 | this._backends = _backends;
|
---|
17 | }
|
---|
18 | push(...backend) {
|
---|
19 | this._backends.push(...backend);
|
---|
20 | }
|
---|
21 | event(category, action, options) {
|
---|
22 | this._backends.forEach((be) => be.event(category, action, options));
|
---|
23 | }
|
---|
24 | screenview(screenName, appName, options) {
|
---|
25 | this._backends.forEach((be) => be.screenview(screenName, appName, options));
|
---|
26 | }
|
---|
27 | pageview(path, options) {
|
---|
28 | this._backends.forEach((be) => be.pageview(path, options));
|
---|
29 | }
|
---|
30 | timing(category, variable, time, options) {
|
---|
31 | this._backends.forEach((be) => be.timing(category, variable, time, options));
|
---|
32 | }
|
---|
33 | flush() {
|
---|
34 | return Promise.all(this._backends.map((x) => x.flush())).then(() => { });
|
---|
35 | }
|
---|
36 | }
|
---|
37 | exports.MultiAnalytics = MultiAnalytics;
|
---|