Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
18e4ef8 to
6c3e761
Compare
fece0b6 to
138440e
Compare
There was a problem hiding this comment.
Checked against dailydotdev/skadi#577: the lifecycle wire shape (version: 1, on, {type: pixel|event}), all 9 event names, legacy /v1/a + sponsor-strip fields, and the viewable contract (viewable impression event + &viewed=true pixel) all match. Thanks for the detailed description.
Blocking: please put the apps-side lifecycle execution behind a GrowthBook flag
Skadi#577 already attaches lifecycle to every display ad (displayAdLifecycle runs unconditionally for Custom/Post/Squad/AdvertiserBar/Digest/Engagement). So this PR is not opt-in per configured creative: the moment it ships, 100% of ad traffic moves to the new Configured* paths, on webapp and extension. The only way to turn it off would be a revert plus a new extension release, and extension builds already in the wild would keep running it.
The client already has the right seam: with lifecycle absent, AdPixel, AdSlot and AdViewability all fall back to today's behaviour. Please add a flag (e.g. ad_slot_lifecycle, default false). When it is off, drop lifecycle from the ad before it is cached / rendered, in useAdQuery, useFetchAd (feed + rotation/refresh) and useSponsorStripAds. Then we can ramp it gradually, per platform, while watching impressions / viewable impressions / clicks, and switch it off instantly if numbers move. The behaviour changes that sit outside the lifecycle path (lib/ads.ts error handling, DropdownMenu) are not covered by such a flag, which is another reason to keep them minimal.
Behaviour that changes at merge: needs explicit approval
Because of the above, these go live for everyone immediately, without anyone configuring a creative:
- Provider pixels mapped by Skadi (e.g. post-fetch and click beacons) start firing for every ad.
- Direct/BSA/EthicalAds impression pixels should be unchanged (same list as
pixel). Please confirm on the preview with a real response.
The inline comments cover the rest. For each one that changes existing behaviour, please either confirm it is intended and get explicit approval, or revert it to how it was if it changed by accident.
Not verified by me: I did not run the tests or the preview locally (CI is green), and provider pixels and the sponsor strip have not been checked end to end on real responses.
Reviewed by AI.
Address review feedback with a default-off rollout flag, legacy fetch retry semantics, wrapper-free click capture, pre-paint render hooks, consent-safe sponsor milestones, bounded generation deduplication, and known analytics event names. Preserve mounted impression and viewability trackers when disabling lifecycle for cached creatives.
There was a problem hiding this comment.
Re-review of dd1264b: thanks. The flag, error handling, dropdown, consent, pre-render, wrapper-free click capture, dedup and event allowlist are all addressed. One remaining issue (see inline): the lifecycle flag shouldn't be part of the query keys. It's not a problem at merge with the flag off by default, but please fix it before ramping.
Reviewed by AI.
| consent?.consentString ?? '', | ||
| consent?.consentExists ?? '', | ||
| isLoggedIn, | ||
| isLifecycleEnabled, |
There was a problem hiding this comment.
Please fix before ramping ad_slot_lifecycle: the flag in the query key causes a refetch. useConditionalFeature returns the default (false) until GrowthBook is ready, then switches to true for the rollout cohort. Because the flag is part of the key, that switch fetches a new ad for the post page, sidebar, comment and hero slots. The slot can swap creative after the first one was shown, which costs an extra request and possibly an extra impression. That only happens to flag-on users, so it would also skew the metrics we watch during the ramp.
Unlike the refresh engine flag, this flag doesn't change the request (Skadi always sends lifecycle), so there's no need to key or wait on it. Suggested fix:
- Remove
isLifecycleEnabledfrom the key. - Move
resolveAdout ofqueryFnintoselect: resolveAd, so the raw response is cached and the flag is applied on read.
Removing it from the key alone is not enough: queryFn would still strip lifecycle before caching, so ads fetched before GrowthBook is ready would stay stripped for their whole cache lifetime. The kill switch still holds with select, since every action already checks isEnabled at run time.
Accepted trade-off: post-fetch actions don't fire for an ad fetched before the flag resolves, because useAdSlotFetch sees it as off at that moment. Render, visibility and click actions still fire once it resolves.
Reviewed by AI.
| AdPlacement.SponsorStrip, | ||
| consent?.gdprApplies, | ||
| consent?.consentString ?? '', | ||
| isEnabled, |
There was a problem hiding this comment.
Same issue as in useAdQuery. isEnabled in the key refetches the strip when the flag resolves to true, which can deal a different set of creatives after the first set was shown. The read side already strips (pools runs resolveAd over data), so please:
- Remove
isEnabledfrom the key. - Drop the
resolveAdmap inqueryFnand cache the parsed creatives as received.
Reviewed by AI.
Execute Skadi's versioned lifecycle action map when an ad is fetched, rendered, becomes visible, or is clicked. Existing impression pixels retain the original viewport marker and image path, including the old-browser fallback and no focus requirement for impressions.
ad_slot_lifecycle, default false. Strip lifecycle configuration before caching or returning ads when disabled, and guard actions on already-cached creatives. Unresolved feature flags continue serving legacy ads.pre-renderin a layout effect after DOM mount and before paint; runpost-renderin a passive effect. The creative renders on the first commit.data-ad-clickmarker; unrelated advertise and upgrade links remain excluded.AdActionsnames. New non-impression URL actions use HTTPS and macro substitution; legacy impression images retain existing URL behavior.Post-fetch semantics: run actions for every creative returned in the sponsor pool, including those not displayed. This is intentional: it records availability/fetching rather than an impression. Taboola AVAILABLE maps to post-fetch, as agreed. Impression and visibility actions still depend on the mounted creative's existing triggers.
Skadi configuration and provider mappings: https://github.com/dailydotdev/skadi/pull/577 (deployed). Response-defined actions begin at post-fetch; pre-fetch is available as a local fetch transition. Non-slot consumers, such as email rendering, do not gain browser lifecycle hooks.
Validation: full webapp suite (90 suites, 726 tests), shared ad/monetization/feed-widget regression suites (66 suites, 566 tests), webapp typecheck, shared and webapp lint/format, and the changed-file strict TypeScript guard. Regression coverage includes default-off and unresolved flags, cached-ad rollback, legacy impression fallback, initial-request retries, consent-delayed sponsor milestones, wrapper-free click capture including portaled menus, generation deduplication, and analytics filtering.
Preview domain
https://codex-ad-slot-lifecycle.preview.app.daily.dev