-
Notifications
You must be signed in to change notification settings - Fork 125
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
fix: dead click fixes from watching in prod #1508
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { assignableWindow, LazyLoadedDeadClicksAutocaptureInterface } from '../utils/globals' | ||
import { PostHog } from '../posthog-core' | ||
import { isNull, isNumber, isUndefined } from '../utils/type-utils' | ||
import { autocaptureCompatibleElements, getEventTarget, isElementNode, isTag } from '../autocapture-utils' | ||
import { autocaptureCompatibleElements, getEventTarget } from '../autocapture-utils' | ||
import { DeadClicksAutoCaptureConfig, Properties } from '../types' | ||
import { autocapturePropertiesForElement } from '../autocapture' | ||
import { isElementInToolbar } from '../utils/element-utils' | ||
import { isElementInToolbar, isElementNode, isTag } from '../utils/element-utils' | ||
|
||
const DEFAULT_CONFIG: Required<DeadClicksAutoCaptureConfig> = { | ||
element_attribute_ignorelist: [], | ||
|
@@ -205,7 +205,9 @@ class LazyLoadedDeadClicksAutocapture implements LazyLoadedDeadClicksAutocapture | |
this._config.selection_change_threshold_ms | ||
) | ||
const mutationTimeout = checkTimeout(click.mutationDelayMs, this._config.mutation_threshold_ms) | ||
const absoluteTimeout = checkTimeout(click.absoluteDelayMs, this._config.mutation_threshold_ms) | ||
// we want to timeout eventually even if nothing else catches it... | ||
// we leave a little longer than the maximum threshold to give the other checks a chance to catch it | ||
const absoluteTimeout = checkTimeout(click.absoluteDelayMs, this._config.mutation_threshold_ms * 1.1) | ||
|
||
const hadScroll = isNumber(click.scrollDelayMs) && click.scrollDelayMs < this._config.scroll_threshold_ms | ||
const hadMutation = | ||
|
@@ -244,22 +246,27 @@ class LazyLoadedDeadClicksAutocapture implements LazyLoadedDeadClicksAutocapture | |
private _captureDeadClick(click: Click, properties: Properties) { | ||
// TODO need to check safe and captur-able as with autocapture | ||
// TODO autocaputure config | ||
this.instance.capture('$dead_click', { | ||
...properties, | ||
...autocapturePropertiesForElement(click.node, { | ||
e: click.originalEvent, | ||
maskAllElementAttributes: this.instance.config.mask_all_element_attributes, | ||
maskAllText: this.instance.config.mask_all_text, | ||
elementAttributeIgnoreList: this._config.element_attribute_ignorelist, | ||
// TRICKY: it appears that we were moving to elementsChainAsString, but the UI still depends on elements, so :shrug: | ||
elementsChainAsString: false, | ||
}).props, | ||
$dead_click_scroll_delay_ms: click.scrollDelayMs, | ||
$dead_click_mutation_delay_ms: click.mutationDelayMs, | ||
$dead_click_absolute_delay_ms: click.absoluteDelayMs, | ||
$dead_click_selection_changed_delay_ms: click.selectionChangedDelayMs, | ||
timestamp: click.timestamp, | ||
}) | ||
this.instance.capture( | ||
'$dead_click', | ||
{ | ||
...properties, | ||
...autocapturePropertiesForElement(click.node, { | ||
e: click.originalEvent, | ||
maskAllElementAttributes: this.instance.config.mask_all_element_attributes, | ||
maskAllText: this.instance.config.mask_all_text, | ||
elementAttributeIgnoreList: this._config.element_attribute_ignorelist, | ||
// TRICKY: it appears that we were moving to elementsChainAsString, but the UI still depends on elements, so :shrug: | ||
elementsChainAsString: false, | ||
}).props, | ||
$dead_click_scroll_delay_ms: click.scrollDelayMs, | ||
$dead_click_mutation_delay_ms: click.mutationDelayMs, | ||
$dead_click_absolute_delay_ms: click.absoluteDelayMs, | ||
$dead_click_selection_changed_delay_ms: click.selectionChangedDelayMs, | ||
}, | ||
{ | ||
timestamp: new Date(click.timestamp), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. turns out this is how you set the timestamp on an event |
||
} | ||
) | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we saw absolute timeouts, without seeing mutation timeouts, that also seems wrong so...