Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

fix(posts): track when users click links within posts [MOSOWEB-49] #74

Merged
merged 4 commits into from
Nov 7, 2023

Conversation

jpezninjo
Copy link

@jpezninjo jpezninjo commented Oct 27, 2023

Goal: When a user clicks a link within a post, we need to log an engagement event. MOSOWEB-49

To Do:

  • Hook into the click handler for the whole Post
  • Fire engagement event
  • Send post ID

Example of a post with a link
image

Engagement event showing up in Debug Ping Viewer
image

@jpezninjo jpezninjo requested a review from a team as a code owner October 27, 2023 19:34
@@ -16,6 +18,13 @@ function onclick(evt: MouseEvent | KeyboardEvent) {
const text = window.getSelection()?.toString()
if (!el && !text)
go(evt)
Copy link
Author

@jpezninjo jpezninjo Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth wondering if it would be safer to place the analytics call before this go to future-proof for links changing to redirects instead of opening in new tab?

This train of thought stems from login/signup button clicks intermittently failing to show up on the debug tool (probably due to doing redirects)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to discern when the go function gets called? I haven't been able to figure it out.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wtfluckey Yup. When you click on a post in a feed and it takes you to the url for the standalone post.

@jpezninjo jpezninjo changed the title [DRAFT] fix(posts): Post nested Links Engagement Events [MOSOWEB-49] fix(posts): Post nested Links Engagement Events [MOSOWEB-49] Oct 27, 2023
@jpezninjo jpezninjo changed the title fix(posts): Post nested Links Engagement Events [MOSOWEB-49] fix(posts): track when users click links within posts [MOSOWEB-49] Oct 27, 2023
@jpezninjo jpezninjo merged commit e854a27 into main Nov 7, 2023
3 checks passed
@jpezninjo jpezninjo deleted the fix/posts-nested-link-clicks branch November 7, 2023 18:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants