guardian / guardian/dotcom-rendering

Missing click events

Open
#12,434 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
274
Forks
34
Avg merge
2d 22h
Merged PRs (30d)
121

Description

Since Ophan tracker JS [v2.2.2](https://github.com/guardian/ophan/releases/tag/v2.2.2), no click events are being tracked for tags with a `data-link-name` attribute unless they are anchor tags.

If you want to see how many elements this affects on any given page, here's a quick JS function you can use:
```
const countNonAnchorTagsWithDataLinkName = () => {
return Array.from(window.document.querySelectorAll('[data-link-name]'))
.filter(el => el.tagName !== "A")
.reduce((acc,el) => {
if (!acc[el.tagName]) return { ...acc, [el.tagName]: 1 }
else return { ...acc, [el.tagName]: acc[el.tagName] + 1 }
},[])
}
```

These were presumably sending events via Ophan before v2.2.2 but will not be since this version of tracker JS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.