Skip to content

Commit 73b62e2

Browse files
committed
Add twitter analytics event
1 parent cae4d73 commit 73b62e2

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

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

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

11-
public eventEmitter(
11+
public sendEvent(
1212
eventName: string,
1313
eventCategory: string,
1414
eventAction: string,
@@ -20,8 +20,8 @@ export class GoogleAnalyticsService {
2020
}
2121
gtag('event', eventName, {
2222
eventCategory: eventCategory,
23-
eventLabel: eventLabel,
2423
eventAction: eventAction,
24+
eventLabel: eventLabel,
2525
eventValue: eventValue
2626
});
2727
}

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("Twitter Button", "button", "click")
18+
}
1419
}

0 commit comments

Comments
 (0)