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: dead click detection #1463

Merged
merged 46 commits into from
Oct 31, 2024
Merged

feat: dead click detection #1463

merged 46 commits into from
Oct 31, 2024

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Oct 12, 2024

We autocapture valid webpage interactions

But some people will want to autocapture invalid interactions

for example in some places in posthog these "i" icons are clickable in others they aren't
Screenshot 2024-10-13 at 23 31 32

deadclick autocapture lets you detect clicks that are not followed by scroll or DOM mutation, so you can see if folk are clicking things thinking something will happen and nothing happens

## Needs

Copy link

vercel bot commented Oct 12, 2024

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Oct 31, 2024 2:31pm

Copy link

github-actions bot commented Oct 12, 2024

Size Change: +46.6 kB (+1.58%)

Total Size: 3.01 MB

Filename Size Change
dist/all-external-dependencies.js 193 kB +11 kB (+6.06%) 🔍
dist/array.full.es5.js 251 kB +1.96 kB (+0.79%)
dist/array.full.js 342 kB +6.25 kB (+1.86%)
dist/array.full.no-external.js 341 kB +6.25 kB (+1.87%)
dist/array.js 168 kB +1.73 kB (+1.04%)
dist/array.no-external.js 167 kB +1.73 kB (+1.04%)
dist/main.js 169 kB +1.73 kB (+1.03%)
dist/module.full.js 342 kB +6.25 kB (+1.87%)
dist/module.full.no-external.js 341 kB +6.25 kB (+1.87%)
dist/module.js 168 kB +1.73 kB (+1.04%)
dist/module.no-external.js 167 kB +1.73 kB (+1.04%)
ℹ️ View Unchanged
Filename Size
dist/dead-clicks-autocapture.js 12.8 kB
dist/exception-autocapture.js 8.77 kB
dist/external-scripts-loader.js 2.19 kB
dist/recorder-v2.js 102 kB
dist/recorder.js 103 kB
dist/surveys-preview.js 56.7 kB
dist/surveys.js 62.1 kB
dist/tracing-headers.js 1.33 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

import { uuidv7 } from '../../uuidv7'
import { DeadClicksAutocapture } from '../../extensions/dead-clicks-autocapture'

describe('DeadClicksAutocapture', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

this outer wrapper delegates entirely to the lazy loaded one so we can test it interacts with a mock as desired and ignore the behaviour

@@ -37,6 +37,202 @@ function limitText(length: number, text: string): string {
return text
}

export function getAugmentPropertiesFromElement(elem: Element): Properties {
Copy link
Member Author

Choose a reason for hiding this comment

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

a bunch of functions move out of the class so we can use them directly because they (mostly) don't rely on state of the class

it should help with bundle size a tiny bit since the names are now minifiable

@pauldambra pauldambra marked this pull request as ready for review October 13, 2024 22:33
@pauldambra pauldambra requested a review from a team October 14, 2024 08:41
Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Didn't look at the implentation of the dead click detection tooooo closely but did a general pass through and I think the approach and changes all look good

cypress/e2e/capture.cy.ts Outdated Show resolved Hide resolved
src/entrypoints/dead-clicks-autocapture.ts Outdated Show resolved Hide resolved
@pauldambra pauldambra added the bump minor Bump minor version when this PR gets merged label Oct 31, 2024
@pauldambra pauldambra merged commit c3de1e5 into main Oct 31, 2024
16 checks passed
@pauldambra pauldambra deleted the feat/dead-click-detection branch October 31, 2024 14:40
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.

6 participants