Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions default/src/app/auth/auth-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { Component } from '@angular/core';
import { AuthService } from './auth.service';

declare var ga: Function;

@Component({
selector: 'auth-button',
Expand All @@ -25,9 +26,11 @@ export class AuthButtonComponent {
);
}
login() {
ga('send', 'event', 'Auth', 'Login', 'click');
this.auth.login();
}
logout() {
ga('send', 'event', 'Auth', 'Logout', 'click');
this.auth.logout();
}
}
3 changes: 3 additions & 0 deletions default/src/app/report/report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { AuthService } from '../auth/index';
// Note that this also imports moment itself.
import * as moment from 'moment-timezone';

declare var ga: Function;

@Component({
selector: 'report',
templateUrl: 'report.component.html',
Expand Down Expand Up @@ -95,6 +97,7 @@ export class ReportComponent {
}

getMoreData(cursor: string) {
ga('send', 'event', 'Report', 'Show more', 'click');
this.queryService.getQueries(cursor).subscribe(
(data: any[]) => {
this.data = this.data.concat(this.processData(data['payload'], data['cursor']));
Expand Down
6 changes: 6 additions & 0 deletions default/src/app/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Component } from '@angular/core';
import { QueryService } from '../query/index';
import {AuthService} from '../auth/auth.service';

declare var ga: Function;

@Component({
selector: 'search',
templateUrl: 'search.component.html',
Expand Down Expand Up @@ -33,18 +35,21 @@ export class SearchComponent {
submit(searchField: string) {
if (searchField !== '') {
this.doSearch(searchField) ;
ga('send', 'event', 'Search', 'submit', 'clicking submit button');
}
}

onPressEnter(e: any, searchField: any) {
if (e.keyCode === 13 && searchField !== '') {
this.doSearch(searchField);
ga('send', 'event', 'Search', 'submit', 'pressing enter');
}
}

doSearch(searchField: any) {
this.queryService.doQuery(searchField, 'site-search').subscribe(
data => {
ga('send', 'event', 'Search', 'source', 'site-search');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move these to before the the doQuery()

// If when data is returned from a query with a redirect set, do the redirect.
if (data['payload']['redirect']) {
this._redirect(data['payload']['redirect']);
Expand All @@ -63,6 +68,7 @@ export class SearchComponent {
if (parameters['q'] != null) {
this.queryService.doQuery(parameters['q'], 'omnibox').subscribe(
response => {
ga('send', 'event', 'Search', 'source', 'omnibox');
return;
}, error => {
console.log('Error happened: ' + error);
Expand Down