fix(widget): per-product proactive opener via product_session cap scope#396
Conversation
The proactive opener fired once per session across every product page because the default frequency_cap.scope was "session" — one shared slot keyed only by pageType. Moving to "product_session" keys the slot by product handle (buildSlotKey in the SDK), so the opener fires once per product per session. Existing stores still carry the old stored value and need a settings backfill; this fixes the default for new stores.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughShopify widget proactive configuration's ChangesWidget Frequency Cap Scope Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
DEFAULT_WIDGET_PROACTIVE_CONFIG.frequency_cap.scopewas"session"— the SDK'sbuildSlotKeykeys asession-scoped cap bypageTypealone, giving one shared slot for all products."product_session". The SDK then keys the slot bypageType_productHandle(proactive-engine.ts:51), so the opener fires once per product per session.Important: existing stores need a backfill
The widget config serve path returns the stored config as-is (no default merge). This PR fixes the default for new stores only. Live stores still carry the old
scope: "session"and need their storedwidget_proactive.frequency_cap.scopeflipped toproduct_sessionviaPATCH /api/sites/{site_id}/settings(handled separately).Test plan
tests/test_widget_proactive_prd007.py::test_default_widget_proactive_shapeupdated + passingbuildSlotKeyhonorsproduct_session(keys by product handle)Summary by CodeRabbit