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: Add prev pageview duration #1348

Merged
merged 3 commits into from
Aug 9, 2024
Merged

Conversation

robbie-c
Copy link
Member

@robbie-c robbie-c commented Aug 9, 2024

Changes

Add prev pageview duration, for a customer, inspired by this slack thread https://posthog.slack.com/archives/C05LJK1N3CP/p1723144788366199

We already do have some logic for measuring the time between the same event (that gets stored in storage rather than in memory), but that doesn't add e.g. pageview duration to a pageleave event, and doesn't match up with the other prev_pageview props like prev_pageview_pathname, which the paths view on web analytics already uses.

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Copy link

vercel bot commented Aug 9, 2024

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Aug 9, 2024 11:56am

@robbie-c robbie-c changed the title Add prev pageview duration feat: Add prev pageview duration Aug 9, 2024
}

private _previousScrollProperties(): PageViewEventProperties {
private _previousPageViewProperties(timestamp: Date): PageViewEventProperties {
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably easier to view this diff without whitespace changes

Copy link

github-actions bot commented Aug 9, 2024

Size Change: +648 B (+0.06%)

Total Size: 1.17 MB

Filename Size Change
dist/array.full.js 333 kB +162 B (+0.05%)
dist/array.js 154 kB +162 B (+0.11%)
dist/main.js 155 kB +162 B (+0.1%)
dist/module.js 154 kB +162 B (+0.11%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 10.4 kB
dist/recorder-v2.js 110 kB
dist/recorder.js 110 kB
dist/surveys-preview.js 59.8 kB
dist/surveys.js 66 kB
dist/tracing-headers.js 8.26 kB
dist/web-vitals.js 5.79 kB

compressed-size-action

@robbie-c robbie-c marked this pull request as ready for review August 9, 2024 12:02
@robbie-c robbie-c added the bump minor Bump minor version when this PR gets merged label Aug 9, 2024
@robbie-c robbie-c merged commit de83356 into main Aug 9, 2024
17 checks passed
@robbie-c robbie-c deleted the feature/add-prev-pageview-duration branch August 9, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants