Repository navigation
Conversation
An impression now needs half the link in the viewport for one continuous second, once per link per page view, matching the MRC viewable display ad definition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Preview deployment: https://busbykxnwacusxweb-issue-1486.preview.avy-fx.org |
Contributor
|
@busbyk very cool follow up in general to all this. We're going to be more dialed than the marketing teams asking for the data. I double checked with NWAC: -yes, count once per placement, not once per sponsor. there will be multiple ads rotating thru the page at once the way the carousel works |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
sponsor_impressionfired whenSponsorLinkmounted, so it counted "the page rendered the block," not "someone saw it." It now fires when at least half of a sponsor link has been in the viewport for one continuous second, at most once per link per page view.sponsor_clickand the event properties are unchanged.Related Issues
Closes #1486
Parent: #1484 — Spec: PostHog across AvyApp, AvyWeb and the NAC widgets
Key Changes
SponsorLinkuses an IntersectionObserver at a 0.5 threshold plus a one-second timer. Dropping below half cancels the timer, and the observer disconnects once the impression fires.How to test
On a page with a sponsor block below the fold (seeded:
/blocks) andNEXT_PUBLIC_POSTHOG_KEYset, confirm no impression on load or on a quick scroll past, exactly one per link after a second in view, none on scrolling away and back, andsponsor_clickon click. PostHog drops events from headless browsers.Checked in Chromium against the dev server with PostHog traffic intercepted locally. The seed has one sponsor per center, so a carousel with several sponsors wasn't exercised.
Screenshots / Demo video
N/A: no visual change.
Migration Explanation
None.
Future enhancements / Questions
Before deploying
Questions for the team
The issue asks for "at most once per sponsor per page view, when at least half of the sponsor link is visible." This PR departs from that in two ways, following Media Rating Council (MRC) ad-measurement guidance. Are we happy with both?
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.