()
| 3 | export 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 | } |
nothing calls this directly
no test coverage detected