Repository navigation
feat(plugin-autocapture-browser): add click cell properties to Element Clicked - #2211
Open
junjie-amplitude wants to merge 1 commit into
Open
junjie-amplitude wants to merge 1 commit into
junjie-amplitude wants to merge 1 commit into
Conversation
…t Clicked
Record where inside the clicked element a pointer click landed. A grid is
laid over the element's bounding box, sized per axis as
clamp(floor(size / minCellSizePx), 1, maxCellsPerAxis), and the cell under
the pointer is sent as [Amplitude] Element Click Cell, formatted
<cols>x<rows>:<col>,<row> (zero-based from the top-left), e.g. 4x3:2,1.
The grid parameters in effect are sent with it as
[Amplitude] Element Click Cell Min Size and
[Amplitude] Element Click Cell Max Per Axis.
The cell is read when the click is captured. Action clicks are tracked
only after a mutation or navigation follows the click, by which time the
element may have moved, resized or left the page, so the cell is computed
when the action-click element is picked and carried to the track call.
New elementInteractions option clickCell: boolean, or
{ enabled, minCellSizePx, maxCellsPerAxis }. Default on with 64 px and 10
cells per axis; unusable values fall back to the defaults. Remote config
delivers { enabled: false } as false and { enabled: true } as true, so the
option accepts both forms. Keyboard and synthetic clicks, zero-size
elements and a disabled option send none of the properties.
HM-39
Contributor
size-limit report 📦
|
Session Replay Browser E2E ResultsDetails
|
cursor
Bot
force-pushed
the
cursor/hm-39-click-cell-9eb2
branch
from
December 1, 2026 11:46
4566849 to
1996724
Compare
junjie-amplitude
marked this pull request as ready for review
December 2, 2026 06:03
junjie-amplitude
requested review from
Mercy811,
daniel-graham-amplitude and
jxiwang
December 2, 2026 06:03
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds three event properties to
[Amplitude] Element Clickedthat record where inside the clicked element the pointer was. The heatmaps in Zoning Insights use them to draw click heat in the right part of large elements. Background and diagrams: proposal. Discussed in the autocapture thread.[Amplitude] Element Click Cell4x3:2,1<cols>x<rows>:<col>,<row>: the cell of a grid laid over the element, zero-based from the top-left[Amplitude] Element Click Cell Min Size64[Amplitude] Element Click Cell Max Per Axis10clamp(floor(size / minCellSizePx), 1, maxCellsPerAxis). The value carries its own grid, so events recorded under different parameters still decode.detail === 0) and zero-size elements send none of the properties. A click outside the element's box (an overflowing descendant) goes to the nearest edge cell.targetElementProperties, so rage, dead and error clicks and page-action triggers are unchanged.Option
autocapture.elementInteractions.clickCell:boolean | { enabled?, minCellSizePx?, maxCellsPerAxis? }. Defaults: on, 64 px, 10. Unusable values fall back to the defaults. It is read once, when the plugin is created.Remote config
The same shape works under
configs.analyticsSDK.browserSDK→autocapture.elementInteractions.clickCell.translateRemoteConfigToLocalrewrites{ enabled: false }tofalseand{ enabled: true }totruebefore the plugin reads the option, so the option accepts both the boolean and the object form. (The pre-release that was dogfooded on amplitude.com did not, and a remoteenabled: falseleft the feature on.)Checked in headless Chrome against the built
amplitude-min.js, with the remote config response mocked:4x3:0,0/4x3:3,2; 100×40 button →1x1:0,0; Enter on the button → no properties; 700×400 action-clickdivwhose handler shrinks it →10x6:9,5clickCell: false, local{ enabled: false }{ enabled: false }, remote{ enabled: false, minCellSizePx: 32 }{ enabled: true }{ enabled: true, minCellSizePx: 32, maxCellsPerAxis: 3 }3x3, button3x1:1,0, parameters reported as 32 and 3For reviewers
resolveClickCellConfig.elementInteractionsreplaces the local object as a whole (existing behaviour ofupdateBrowserConfigWithRemoteConfig). A localclickCell: falseis therefore lost when remote config deliverselementInteractionswithoutclickCell, and the default applies. Not changed here.viewportContentUpdatedsolves the sameenabledrewrite by convertingtrue/falseback to an object insidetranslateRemoteConfigToLocal. This PR accepts the boolean in the plugin instead, likedeadClicks/rageClicks, so core needs no special case. Happy to switch.[Amplitude] Page X/Page Yand the element width and height from the dogfood draft (feat(plugin-autocapture-browser): add [Amplitude] Page X/Y and click cell to Element Clicked #2146), taxonomy descriptions and SDK docs (HM-26), and the remote config form schema (HM-32).Tests
resolveClickCellConfig(boolean and object forms, defaults, invalid values) andgetClickCellProperties(grid sizes at the boundaries, cell index at corners / edges / outside the box, custom parameters, every omission case, a bounding box that throws).true,{ enabled: true }, custom grid, keyboard,false,{ enabled: false }, no element size sent) and action clicks (the cell reflects the box at click time when the element changes before tracking; keyboard;false).analytics-browserjoined-configtests for what remote config delivers forclickCell.plugin-autocapture-browser: 712 tests pass with 100% coverage.analytics-browser(531) andanalytics-core(970) pass with 100% coverage. eslint, prettier andpnpm lint:depspass.Linear: https://linear.app/amplitude/issue/HM-39
Checklist
Note
Medium Risk
New event properties are emitted by default on every pointer Element Clicked, increasing payload and analytics surface; click-handling code on the hot path was extended but is defensive.
Reviewed by Cursor Bugbot for commit 1996724. Bugbot is set up for automated code reviews on this repo. Configure here.