@affiliateo/web 2.2.0 → 2.3.0
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 +5 -1
- package/dist/provider.js +18 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,7 +171,11 @@ attributes become metadata (kebab-case → snake_case, up to 10 params).
|
|
|
171
171
|
</section>
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
Fires once when the section
|
|
174
|
+
Fires once when 10% of the section enters the viewport (combined with a
|
|
175
|
+
small bottom-edge rootMargin so it doesn't fire on sections barely peeking
|
|
176
|
+
up from the bottom of the screen). The lower threshold catches tall
|
|
177
|
+
sections like pricing pages with comparison tables that would otherwise
|
|
178
|
+
top out under 50% intersection and never fire. Great for landing pages
|
|
175
179
|
where you want to know which sections convert.
|
|
176
180
|
|
|
177
181
|
### Goal naming rules
|
package/dist/provider.js
CHANGED
|
@@ -331,6 +331,23 @@ 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
|
+
// Threshold: 0.1 (was 0.5). 50% visibility is unreachable for tall
|
|
336
|
+
// sections — a 1600px pricing section in an 800px viewport tops out
|
|
337
|
+
// at ~50% intersection ratio, so the observer's threshold was either
|
|
338
|
+
// a bare miss (section maxes at 49%) or a brittle hit. Funnel steps
|
|
339
|
+
// tied to those sections silently dropped from every merchant's
|
|
340
|
+
// conversion count without anyone noticing the section was even
|
|
341
|
+
// being rendered. 0.1 fires when 10% of the section is visible,
|
|
342
|
+
// which on a typical laptop is "the user has scrolled enough that
|
|
343
|
+
// the section is meaningfully on screen" without firing on sections
|
|
344
|
+
// that barely peek up from the bottom edge.
|
|
345
|
+
//
|
|
346
|
+
// rootMargin: trim the bottom 10% of the viewport from the trigger
|
|
347
|
+
// zone so a section creeping up from the very bottom of the screen
|
|
348
|
+
// doesn't fire instantly. The user has to scroll enough that the
|
|
349
|
+
// section is starting to settle into the main visible area, which
|
|
350
|
+
// matches a human's intuitive sense of "I've reached that section."
|
|
334
351
|
const scrollFired = new WeakSet();
|
|
335
352
|
let scrollObserver = null;
|
|
336
353
|
let scrollMo = null;
|
|
@@ -347,7 +364,7 @@ export function AffiliateoProvider({ campaignId, apiUrl, children, }) {
|
|
|
347
364
|
track(goal);
|
|
348
365
|
scrollObserver?.unobserve(entry.target);
|
|
349
366
|
}
|
|
350
|
-
}, { threshold: 0.
|
|
367
|
+
}, { threshold: 0.1, rootMargin: '0px 0px -10% 0px' });
|
|
351
368
|
// Observe everything that exists at mount time.
|
|
352
369
|
document.querySelectorAll('[data-affiliateo-scroll]').forEach((el) => {
|
|
353
370
|
scrollObserver?.observe(el);
|