mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-09-22 05:50:48 +02:00
chore(analytics): track theme switch and start search events
This commit is contained in:
parent
6ef5f90f7c
commit
c28cf8f2d4
4 changed files with 17 additions and 3 deletions
|
@ -22,4 +22,10 @@ export class AnalyticsService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trackEvent(eventName: string) {
|
||||||
|
if (this._enabled) {
|
||||||
|
ga('send', 'event', eventName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
<nb-action class="control-item" disabled icon="nb-notifications"></nb-action>
|
<nb-action class="control-item" disabled icon="nb-notifications"></nb-action>
|
||||||
<nb-action class="control-item" icon="nb-email"></nb-action>
|
<nb-action class="control-item" icon="nb-email"></nb-action>
|
||||||
<nb-action class="control-item">
|
<nb-action class="control-item">
|
||||||
<nb-search type="rotate-layout"></nb-search>
|
<nb-search type="rotate-layout" (click)="startSearch()"></nb-search>
|
||||||
</nb-action>
|
</nb-action>
|
||||||
</nb-actions>
|
</nb-actions>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { NbMenuService, NbSidebarService } from '@nebular/theme';
|
import { NbMenuService, NbSidebarService } from '@nebular/theme';
|
||||||
import { UserService } from '../../../@core/data/users.service';
|
import { UserService } from '../../../@core/data/users.service';
|
||||||
|
import { AnalyticsService } from '../../../@core/utils/analytics.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ngx-header',
|
selector: 'ngx-header',
|
||||||
|
@ -19,7 +20,8 @@ export class HeaderComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private sidebarService: NbSidebarService,
|
constructor(private sidebarService: NbSidebarService,
|
||||||
private menuService: NbMenuService,
|
private menuService: NbMenuService,
|
||||||
private userService: UserService) {
|
private userService: UserService,
|
||||||
|
private analyticsService: AnalyticsService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -40,4 +42,8 @@ export class HeaderComponent implements OnInit {
|
||||||
goToHome() {
|
goToHome() {
|
||||||
this.menuService.navigateHome();
|
this.menuService.navigateHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startSearch() {
|
||||||
|
this.analyticsService.trackEvent('startSearch');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { NbThemeService } from '@nebular/theme';
|
import { NbThemeService } from '@nebular/theme';
|
||||||
import { NbJSThemeOptions } from '@nebular/theme/services/js-themes/theme.options';
|
import { NbJSThemeOptions } from '@nebular/theme/services/js-themes/theme.options';
|
||||||
|
import { AnalyticsService } from '../../../@core/utils/analytics.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ngx-theme-switcher',
|
selector: 'ngx-theme-switcher',
|
||||||
|
@ -19,7 +20,7 @@ import { NbJSThemeOptions } from '@nebular/theme/services/js-themes/theme.option
|
||||||
export class ThemeSwitcherComponent implements OnInit {
|
export class ThemeSwitcherComponent implements OnInit {
|
||||||
theme: NbJSThemeOptions;
|
theme: NbJSThemeOptions;
|
||||||
|
|
||||||
constructor(private themeService: NbThemeService) {
|
constructor(private themeService: NbThemeService, private analyticsService: AnalyticsService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -30,6 +31,7 @@ export class ThemeSwitcherComponent implements OnInit {
|
||||||
toggleTheme(theme: boolean) {
|
toggleTheme(theme: boolean) {
|
||||||
const boolTheme = this.boolToTheme(theme);
|
const boolTheme = this.boolToTheme(theme);
|
||||||
this.themeService.changeTheme(boolTheme);
|
this.themeService.changeTheme(boolTheme);
|
||||||
|
this.analyticsService.trackEvent('switchTheme');
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBoolTheme() {
|
currentBoolTheme() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue