File tree Expand file tree Collapse file tree 4 files changed +38
-2
lines changed
components/doc/link-with-icon Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 4
4
}}
5
5
6
6
{{ #if @route }}
7
- <LinkTo class ={{ this.classNames }} @route ={{ @route }} @models ={{ this.models }} ...attributes>
7
+ <LinkTo
8
+ class ={{ this.classNames }}
9
+ @route ={{ @route }}
10
+ @models ={{ this.models }}
11
+ ...attributes
12
+ {{ on " click" (fn this.eventTracking.trackEvent @eventName )}}
13
+ >
8
14
{{ @label }}
9
15
<FlightIcon class =" doc-link-with-icon__icon" @name ={{ @icon }} />
10
16
</LinkTo >
11
17
{{ /if }}
12
18
{{ #if @href }}
13
- <a class ={{ this.classNames }} href ={{ @href }} target =" _blank" rel =" noopener noreferrer" ...attributes>
19
+ <a
20
+ class ={{ this.classNames }}
21
+ href ={{ @href }}
22
+ target =" _blank"
23
+ rel =" noopener noreferrer"
24
+ {{ on " click" (fn this.eventTracking.trackEvent @eventName )}}
25
+ ...attributes
26
+ >
14
27
{{ @label }}
15
28
<FlightIcon class =" doc-link-with-icon__icon" @name ={{ @icon }} />
16
29
</a >
Original file line number Diff line number Diff line change 4
4
*/
5
5
6
6
import Component from '@glimmer/component' ;
7
+ import { inject as service } from '@ember/service' ;
7
8
8
9
export default class DocLinkWithIconComponent extends Component {
10
+ @service eventTracking ;
11
+
9
12
get models ( ) {
10
13
// we need to use this trick to overcome the problem of `<LinkTo>` going beserk if we pass
11
14
// a `@model` argument which is undefined (while an empty `@models` array is OK)
Original file line number Diff line number Diff line change
1
+ import Service from '@ember/service' ;
2
+ import { inject as service } from '@ember/service' ;
3
+ import { action } from '@ember/object' ;
4
+
5
+ export default class EventService extends Service {
6
+ @service fastboot ;
7
+
8
+ @action
9
+ trackEvent ( eventName ) {
10
+ // Only attempt to do something if we are in the right environment
11
+ if ( ! this . fastboot . isFastBoot && window . fathom && eventName ) {
12
+ // https://usefathom.com/docs/features/events
13
+ window . fathom . trackEvent ( eventName ) ;
14
+ }
15
+ }
16
+ }
Original file line number Diff line number Diff line change 16
16
@label =" Release Notes"
17
17
@icon =" arrow-right"
18
18
@isAnimated ={{ true }}
19
+ @eventName =" Hero - Release Notes"
19
20
/>
20
21
<Doc::LinkWithIcon
21
22
@href =" https://go.hashi.co/hds-rollout"
22
23
@label =" Helios Roadmap"
23
24
@icon =" external-link"
24
25
@isAnimated ={{ true }}
26
+ @eventName =" Hero - Roadmap"
25
27
/>
26
28
<Doc::LinkWithIcon
27
29
@href =" https://go.hashi.co/hds-feedback"
28
30
@label =" Share Feedback"
29
31
@icon =" external-link"
30
32
@isAnimated ={{ true }}
33
+ @eventName =" Hero - Feedback"
31
34
/>
32
35
</div >
33
36
</div >
44
47
@fillParent ={{ true }}
45
48
@isAnimated ={{ true }}
46
49
aria-label ={{ concat " Explore " card.title " : " card.description }}
50
+ @eventName ={{ concat " Card - " card.title }}
47
51
/>
48
52
</li >
49
53
{{ /each }}
You can’t perform that action at this time.
0 commit comments