You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(pixel): use ResizeObserver to detect above-fold scroll state (SDK-275)
The above-fold check was a synchronous snapshot taken at tracker init
time. On third-party sites that initialise the pixel before images or
JS-rendered content has expanded the page, scrollHeight could equal
innerHeight at that moment — locking in isAboveFold = true and firing
a false scroll_depth { depth: 100, aboveFold: true } event ~2s later
even on long pages.
Replace the one-shot check with a ResizeObserver on documentElement
that manages the dwell timer reactively: starts when the page is
above-fold, cancels if the page later grows, fires once stable for
the dwell window. Feature-detected to avoid breaking autocapture
on the ~3% of browsers without ResizeObserver.
Also adds AGENTS.md to packages/audience/{pixel,core} flagging the
inline-bundling relationship and CI bundle-size enforcement, since
core changes silently affect the pixel CDN bundle's size budget.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Shared internals for the Audience SDKs. Two consumers worth knowing about:
4
+
5
+
-**`@imtbl/pixel`** bundles this package **inline** into a CDN snippet with a strict size budget. Adding code, dependencies, or large constants here can push the pixel over budget — see [`packages/audience/pixel/AGENTS.md`](../pixel/AGENTS.md). CI runs the pixel bundle-size check on every PR touching `core/**`.
6
+
-**`@imtbl/audience-sdk`** consumes this package normally as a workspace dep.
7
+
8
+
Prefer narrow, tree-shakeable exports. A helper that's only imported by the SDK still costs the pixel bundle bytes if it's reachable from a shared module graph.
This package ships a third-party tracking snippet served from `cdn.immutable.com` and embedded on customer sites. **Bundle size is a hard product constraint.**
4
+
5
+
- Budget lives in [`bundlebudget.json`](./bundlebudget.json) (currently 10 KB max / 8 KB warn, gzipped).
6
+
- CI enforces it on every PR touching `packages/audience/pixel/**` or `packages/audience/core/**` via [`.github/workflows/pixel-bundle-size.yaml`](../../../.github/workflows/pixel-bundle-size.yaml) — builds base vs. head, posts a delta comment, fails over budget. Don't re-build locally to verify size; the workflow is the source of truth.
7
+
-`@imtbl/audience-core` is **bundled inline** via the `tsup.config.ts` alias, not externalised. Changes to `core` count toward this budget — that's why the workflow triggers on `core/**` paths too.
0 commit comments