1
0
mirror of https://github.com/akveo/eva-icons.git synced 2025-02-21 08:12:27 +01:00

fix(analytics): update analytics service (#37)

* fix(analytics): update analytics service

* fix(analytics): update analytics service, remove ga detection
This commit is contained in:
Denis Strigo 2018-11-26 19:05:41 +03:00 committed by GitHub
parent 9298aa76ad
commit 5d18d124f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 6 deletions

View File

@ -27,6 +27,6 @@ export class HeaderComponent {
clickOnDownloadPack() {
const version = this.versionService.getEvoVersion();
this.analytics.trackEvent('download-pack', `download pack version: ${version}`);
this.analytics.trackEvent('downloadPack', `download pack version: ${version}`);
}
}

View File

@ -40,6 +40,6 @@ export class DownloadIconComponent implements AfterViewInit {
}
clickOnDownloadIcon(icon: { format: string; title: string }) {
this.analytics.trackEvent('download-icon', `${this.selectedIcon}.${icon.format}`);
this.analytics.trackEvent('downloadIcon', `${this.selectedIcon}.${icon.format}`);
}
}

View File

@ -135,7 +135,7 @@ export class PageContainerComponent implements AfterViewInit, OnDestroy {
}
clickIcon(icon) {
this.analytics.trackEvent('open-icon-dialog', icon);
this.analytics.trackEvent('openIconDialog', icon);
if (this.isMobileMode) {
return;

View File

@ -6,7 +6,6 @@
import { Injectable, Inject } from '@angular/core';
import { NB_WINDOW } from '@nebular/theme';
declare const ga: any;
@Injectable()
export class EvaAnalytics {
@ -18,7 +17,12 @@ export class EvaAnalytics {
trackEvent(eventName: string, eventVal: string = '') {
if (this.enabled) {
ga('send', 'event', eventName, eventVal);
this.gtmPushToDataLayer({ event: eventName, eventValue: eventVal });
}
}
// Push to 'dataLayer' Google Tag Manager array
private gtmPushToDataLayer(params) {
this.window.dataLayer.push(params);
}
}

View File

@ -1,7 +1,9 @@
<!doctype html>
<html lang="en">
<head>
<script>
dataLayer = [];
</script>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],