Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Analytics scroll depth #12079

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

feat: Analytics scroll depth #12079

wants to merge 6 commits into from

Conversation

a-hariti
Copy link
Collaborator

closes #12061

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 9:57pm
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 9:57pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Dec 10, 2024 9:57pm

Copy link

codecov bot commented Dec 10, 2024

Bundle Report

Changes will increase total bundle size by 6.26kB (0.03%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 10.35MB 3.08kB (0.03%) ⬆️
sentry-docs-client-array-push 9.27MB 3.18kB (0.03%) ⬆️

@@ -31,6 +31,9 @@ export const metadata: Metadata = {
export default function RootLayout({children}: {children: React.ReactNode}) {
return (
<html lang="en" suppressHydrationWarning>
<head>
<PlausibleProvider domain="docs.sentry.io,rollup.sentry.io" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need dev docs as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, we should ask @lizokm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like we have Plausible installed on dev docs (if it is, it's not hooked up to the company account).

@@ -3,7 +3,7 @@ import './globals.css';
import {Theme} from '@radix-ui/themes';
import type {Metadata} from 'next';
import {Rubik} from 'next/font/google';
import Script from 'next/script';
import PlausibleProvider from 'next-plausible';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the advantage of having this instead of the script?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send events dynamically through a hook, nice TS and local DX experience

if (document.documentElement.scrollHeight - window.innerHeight === 0) {
return () => {};
}
const debouncedTrackProgress = debounce(trackProgress, 20);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline: this prevents events from being sent when a user very quickly scrolls to the bottom and then leaves the page - which might not count as a read anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it doesn't happen if you scroll at any reasonable reading speed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using the IntersectionObserver API for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current approach is more precise

the marketing site / blog use the intersection observer and report 100% when the last heading is reached

a useful heuristic, but not very precise

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IntersectionObserver is more performant and since it's already being used by the marketing site, we should be keeping the measurement methods the same for better comparison.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Scroll Depth tracking on Plausible
3 participants