ampproject / ampproject/amphtml
Improve analytics event flow
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
**summary**
As a followup to https://github.com/ampproject/amphtml/pull/32637
Ideally analytics events should not need to traverse the DOM to find the associated ampdoc, window, and associated metadata.
One potential resolution would be to update the functions (at least `triggerEventForTarget`) and associated callsites to receive the necessary metadata (e.g. ampdoc) as part of the initial call. This would address the issue related to attempting to call analytics events on detached nodes
cc @micajuine-ho
Contributor guide
Research direction
Start by reading triggerEventForTarget and its associated callsites, then review the follow-up context in PR 32637. Trace how analytics events currently find the ampdoc, window, and metadata through the DOM; done means the flow receives the needed metadata directly and no longer fails for detached nodes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- analytics, frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100