MCPcopy Create free account
hub / github.com/codecombat/codecombat / mounted

Function mounted

app/components/mixins/auto-tracked.js:5–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3export default {
4 mixins: [trackable],
5 mounted () {
6 this.$el.addEventListener('click', (event) => {
7 let element = event.target
8
9 while (element && element.nodeName !== 'A' && element.nodeName !== 'BUTTON') {
10 // find the closest link or button
11 element = element.parentNode
12 }
13
14 let href = element.href
15 if (href === '#') {
16 href = null
17 }
18
19 if (element) {
20 const eventName = `CTA ${href || element.innerText} clicked on ${window.location.pathname}`
21 const data = {
22 link: href || '',
23 text: element.innerText,
24 path: window.location.pathname,
25 }
26 this.trackEvent(eventName, data)
27 }
28 })
29 },
30}

Callers

nothing calls this directly

Calls 1

trackEventMethod · 0.45

Tested by

no test coverage detected