@affiliateo/web 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/provider.js +12 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,8 +171,12 @@ attributes become metadata (kebab-case → snake_case, up to 10 params).
|
|
|
171
171
|
</section>
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
Fires
|
|
175
|
-
|
|
174
|
+
Fires the first time any pixel of the section overlaps the viewport.
|
|
175
|
+
Maximum permissiveness — if the user scrolled enough to see even a sliver,
|
|
176
|
+
it counts. Earlier versions required 50% visibility, which was unreachable
|
|
177
|
+
for tall sections (a pricing page with comparison tables silently dropped
|
|
178
|
+
out of every funnel). Great for landing pages where you want to know
|
|
179
|
+
which sections convert.
|
|
176
180
|
|
|
177
181
|
### Goal naming rules
|
|
178
182
|
|
package/dist/provider.js
CHANGED
|
@@ -331,6 +331,17 @@ export function AffiliateoProvider({ campaignId, apiUrl, children, }) {
|
|
|
331
331
|
// the viewport. Use IntersectionObserver (cheap, off the scroll hot
|
|
332
332
|
// path) and unobserve after the first fire so the same element can't
|
|
333
333
|
// double-count if the user scrolls back up.
|
|
334
|
+
//
|
|
335
|
+
// No options object → IntersectionObserver defaults to
|
|
336
|
+
// { threshold: 0, rootMargin: '0px 0px 0px 0px' }, which fires the
|
|
337
|
+
// instant ANY pixel of the section overlaps the viewport. That's
|
|
338
|
+
// exactly the semantic merchants want for "did the visitor reach
|
|
339
|
+
// this section": if they scrolled enough to see even a sliver of
|
|
340
|
+
// it, count it. Earlier versions used { threshold: 0.5 }, which
|
|
341
|
+
// was unreachable for tall sections (a 1600px pricing section in
|
|
342
|
+
// an 800px viewport tops out at ~50% intersection ratio and never
|
|
343
|
+
// crossed the threshold) — funnel steps tied to those sections
|
|
344
|
+
// silently dropped from every merchant's conversion count.
|
|
334
345
|
const scrollFired = new WeakSet();
|
|
335
346
|
let scrollObserver = null;
|
|
336
347
|
let scrollMo = null;
|
|
@@ -347,7 +358,7 @@ export function AffiliateoProvider({ campaignId, apiUrl, children, }) {
|
|
|
347
358
|
track(goal);
|
|
348
359
|
scrollObserver?.unobserve(entry.target);
|
|
349
360
|
}
|
|
350
|
-
}
|
|
361
|
+
});
|
|
351
362
|
// Observe everything that exists at mount time.
|
|
352
363
|
document.querySelectorAll('[data-affiliateo-scroll]').forEach((el) => {
|
|
353
364
|
scrollObserver?.observe(el);
|