Skip to content

Commit

Permalink
Merge branch 'main' into feat/dead-click-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Oct 21, 2024
2 parents a823050 + 81e97f1 commit 5a5fb8f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.174.2 - 2024-10-18

- fix: no need to swallow import errors (#1486)

## 1.174.1 - 2024-10-18

- fix: do not capture entire elements in web vitals (#1483)

## 1.174.0 - 2024-10-17

- Make entire cancel button area clickable (#1473)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "posthog-js",
"version": "1.174.0",
"version": "1.174.2",
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",
"repository": "https://github.com/PostHog/posthog-js",
"author": "[email protected]",
Expand Down
15 changes: 4 additions & 11 deletions src/entrypoints/recorder.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { version } from 'rrweb/package.json'

// Same as loader-globals.ts except includes rrweb2 scripts.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import rrwebRecord from 'rrweb/es/rrweb/packages/rrweb/src/record'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { getRecordConsolePlugin } from 'rrweb/es/rrweb/packages/rrweb/src/plugins/console/record'
import { getRecordConsolePlugin, record } from 'rrweb'

// rrweb/network@1 code starts
// most of what is below here will be removed when rrweb release their code for this
Expand Down Expand Up @@ -676,15 +669,15 @@ export const getRecordNetworkPlugin: (options?: NetworkRecordOptions) => RecordP

assignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}
assignableWindow.__PosthogExtensions__.rrwebPlugins = { getRecordConsolePlugin, getRecordNetworkPlugin }
assignableWindow.__PosthogExtensions__.rrweb = { record: rrwebRecord, version: 'v2', rrwebVersion: version }
assignableWindow.__PosthogExtensions__.rrweb = { record: record, version: 'v2', rrwebVersion: version }

// we used to put all of these items directly on window, and now we put it on __PosthogExtensions__
// but that means that old clients which lazily load this extension are looking in the wrong place
// yuck,
// so we also put them directly on the window
// when 1.161.1 is the oldest version seen in production we can remove this
assignableWindow.rrweb = { record: rrwebRecord, version: 'v2', rrwebVersion: version }
assignableWindow.rrweb = { record: record, version: 'v2', rrwebVersion: version }
assignableWindow.rrwebConsoleRecord = { getRecordConsolePlugin }
assignableWindow.getRecordNetworkPlugin = getRecordNetworkPlugin

export default rrwebRecord
export default record
8 changes: 8 additions & 0 deletions src/extensions/web-vitals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ export class WebVitalsAutocapture {
? Date.now()
: this.buffer.firstMetricTimestamp

if (metric.attribution && metric.attribution.interactionTargetElement) {
// we don't want to send the entire element
// they can be very large
// TODO we could run this through autocapture code so that we get elements chain info
// and can display the element in the UI
metric.attribution.interactionTargetElement = undefined
}

this.buffer.metrics.push({
...metric,
$current_url: $currentUrl,
Expand Down

0 comments on commit 5a5fb8f

Please sign in to comment.