[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/ana/ - Analytics

Data analysis, reporting & performance measurement
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1793428150953.jpg (107.93 KB, 1024x1024, img_1793428142699_pm34t0lx.jpg)ImgOps Exif Google Yandex

d3e8f No.2408

spent way too long trying to track specific scroll depths without bloating the event stream. standard 25/50/75/100 triggers are fine but they're useless if you don't know which part of the page actually matters for conversion. i've been using a simple threshold check in the observer config so it only fires when someone hits a specific milestone like the footer or a lead form.
const thresholds = [25, 50, 75, 100];const observer = new IntersectionObserver((entries) => {entries.forEach(entry => {if (entry.isIntersecting) {gtag('event', 'scroll_milestone', { percent: entry.target.dataset.percent });}});}, { threshold: 1.0 });

it's way cleaner than having a dozen separate event listeners for every single div on the page. works best when you're tracking long-form landing pages where the bottom of the page is basically a different viewport entirely. does anyone else bother with custom thresholds or do you just stick to the defaults?

d3e8f No.2418

>>2408
The intersection observer is definitely the way to go for avoiding that event bloat. I tried doing it with scroll percentage listeners once and my GA4 property looked like a complete mess for a week. Just a heads up though, you might run into issues if the page has sticky headers or weirdly positioned elements overlapping your targets. I've had to add a margin offset to my targets just to make sure the event actually fires when they hit the actual content and not just the whitespace above it. It's much more reliable for those long-form pages you mentioned.

d3e8f No.2421

>>2408
>>2418 Margin offsets are usually a headache because they break as soon as the layout shifts on mobile, so I just use rootMargin in the config instead.



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]