Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

o-tracking add IntersectionObserver.threshold as opt #1948

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gyss
Copy link
Contributor

@gyss gyss commented Jan 23, 2025

Description

I'm configuring the App Homepage scrolldepth tracking event using oTracking.view.init() in this PR by setting a selector that will trigger this event every time a <section /> comes into the viewport. In the beginning, it was working as expected, but after some days I retested it and the scrolldepth events were not being sent as expected.

After some investigation, I realized that the problem was located in the 1.0 IntersectionObserver threshold defined here. Looking at the docs, this means that "A value of 1.0 means that the threshold isn't considered passed until every pixel is visible". This is not a problem in medium / big screens, since they can fit a whole <section /> in the viewport (that's why it worked in the beginning), but for small screens, is rather difficult to fit the whole <section /> in it.

I've considered changing the selector provided to this function by selecting only the first teaser of each <section />, but the payload sent to Spoor changes drastically.

So, to fix this, we can modify the threshold to a lover value so the event triggers with smaller portions of the <section />.

Issue ticket number and link

Relates to this ticket

Link to Figma designs

Checklist before requesting a review

  • I have applied percy label for o-[COMPONENT] or chromatic label for o3-[COMPONENT] on my PR before merging and after review. Find more details in CONTRIBUTING.md
  • If it is a new feature, I have added thorough tests.
  • I have updated relevant docs.
  • I have updated relevant env variables in Doppler.

@gyss gyss requested a review from a team as a code owner January 23, 2025 08:35
@gyss gyss force-pushed the o-tracking-component-view-config-threshold branch from 4bd0deb to 2a30d77 Compare January 23, 2025 09:02
@notlee notlee temporarily deployed to origami-webs-o-tracking-yl7vqn January 23, 2025 09:25 Inactive
@gyss gyss force-pushed the o-tracking-component-view-config-threshold branch from 2a30d77 to b995f94 Compare January 23, 2025 17:12
@notlee notlee temporarily deployed to origami-webs-o-tracking-yl7vqn January 23, 2025 17:12 Inactive
@gyss gyss force-pushed the o-tracking-component-view-config-threshold branch from b995f94 to 1b06b29 Compare January 24, 2025 09:49
@notlee notlee temporarily deployed to origami-webs-o-tracking-yl7vqn January 24, 2025 09:49 Inactive
@notlee notlee self-requested a review January 24, 2025 10:17
Copy link
Contributor

@notlee notlee left a comment

Choose a reason for hiding this comment

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

Hey Jose, this looks sensible to me. Please document the new option.

I'll leave to the Data Platform team to approve, as they own o-tracking. You can get hold of them in #data-support.

@gyss gyss force-pushed the o-tracking-component-view-config-threshold branch from 1b06b29 to 6f4ed74 Compare January 24, 2025 10:32
@notlee notlee temporarily deployed to origami-webs-o-tracking-yl7vqn January 24, 2025 10:32 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants