mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 16:30:13 +01:00
fix(analytics): update analytics service, add detection if google analytics was loaded
This commit is contained in:
parent
c998d679d5
commit
c019de67c6
1 changed files with 7 additions and 1 deletions
|
|
@ -28,8 +28,14 @@ export class AnalyticsService {
|
|||
}
|
||||
|
||||
trackEvent(eventName: string, eventVal: string = '') {
|
||||
if (this.enabled) {
|
||||
if (this.enabled && this.window.ga) {
|
||||
ga('send', 'event', eventName, eventVal);
|
||||
}
|
||||
|
||||
if (!this.window.ga) {
|
||||
setTimeout(() => {
|
||||
this.trackEvent(eventName, eventVal);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue