Skip to content

Commit f3dbf40

Browse files
authored
Merge pull request trungvose#64 from trungk18/phase1-bugs-fixing
Add twitter analytics event
2 parents 7aeb63c + a461e1c commit f3dbf40

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

frontend/src/app/core/services/google-analytics.service.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,19 @@ export class GoogleAnalyticsService {
88
constructor() {
99
}
1010

11-
public eventEmitter(
11+
public sendEvent(
1212
eventName: string,
1313
eventCategory: string,
14-
eventAction: string,
1514
eventLabel: string = null,
1615
eventValue: number = null
1716
) {
1817
if (!gtag) {
1918
return;
2019
}
2120
gtag('event', eventName, {
22-
eventCategory: eventCategory,
23-
eventLabel: eventLabel,
24-
eventAction: eventAction,
25-
eventValue: eventValue
21+
'event_category': eventCategory,
22+
'event_label': eventLabel,
23+
'value': eventValue
2624
});
2725
}
2826

frontend/src/app/project/pages/board/board.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<div class="text-2xl font-medium">Kanban board</div>
55
<div class="social-links">
66
<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Ftrungk18%2Fjira-clone-angular&text=Awesome%20Jira%20clone%20app%20built%20with%20Angular%209%20and%20Akita&hashtags=angular,akita,typescript"
7+
(click)="sendTwitterEventButton()"
78
target="_blank"
89
rel="noreferrer noopener"
910
class="mr-2">
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2+
import { GoogleAnalyticsService } from '@trungk18/core/services/google-analytics.service';
23

34
@Component({
45
selector: 'board',
@@ -7,8 +8,12 @@ import { Component, OnInit } from '@angular/core';
78
})
89
export class BoardComponent implements OnInit {
910
breadcrumbs: string[] = ['Projects', 'Angular Jira Clone', 'Kanban Board'];
10-
11-
constructor() {}
11+
12+
constructor(private _googleAnalytics: GoogleAnalyticsService) {}
1213

1314
ngOnInit(): void {}
15+
16+
sendTwitterEventButton() {
17+
this._googleAnalytics.sendEvent("Share Twitter", "button")
18+
}
1419
}

0 commit comments

Comments
 (0)