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(web-analytics): Add property for autocapture link click #1259

Merged
merged 6 commits into from
Jun 21, 2024

Conversation

robbie-c
Copy link
Member

@robbie-c robbie-c commented Jun 20, 2024

Changes

This PR creates a new property, which is the href when an external link is clicked. External is defined as a different host, and the intention here is for people to measure things like which landing pages lead to which external link clicks.

(I was basically nerd-sniped into adding this by some customer feedback)

We already capture this, but it's very buried inside the $element array, and not always at the same place (not always $elements.0.attr_href), so its hard to add to the sessions MV.

Tested this manually by adding an external link to the nextjs playground, and confirming that I could see the event and property.

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 Jun 20, 2024

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Jun 21, 2024 11:40am

Copy link

github-actions bot commented Jun 20, 2024

Size Change: +64 B (+0.01%)

Total Size: 1.01 MB

Filename Size Change
dist/array.full.js 241 kB +42 B (+0.02%)
dist/array.js 138 kB +40 B (+0.03%)
dist/es.js 138 kB +40 B (+0.03%)
dist/module.js 139 kB +40 B (+0.03%)
dist/surveys-module-previews.js 59.6 kB -49 B (-0.08%)
dist/surveys.js 61.2 kB -49 B (-0.08%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 12.2 kB
dist/recorder-v2.js 109 kB
dist/recorder.js 109 kB
dist/tracing-headers.js 8.26 kB

compressed-size-action

@robbie-c robbie-c added the bump minor Bump minor version when this PR gets merged label Jun 20, 2024
@robbie-c robbie-c force-pushed the feat/create-property-for-autocapture-link-clicks branch from e60c7e5 to 0979804 Compare June 21, 2024 06:58
Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

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

Found a typo, otherwise looks good. Not 100% convinced of the property name, but got nothing better.

src/__tests__/autocapture.test.ts Outdated Show resolved Hide resolved
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