Skip to content

feat(perps): introduce perps charts tracking#9221

Merged
geositta merged 4 commits into
mainfrom
perps/trading-service-events
Jun 24, 2026
Merged

feat(perps): introduce perps charts tracking#9221
geositta merged 4 commits into
mainfrom
perps/trading-service-events

Conversation

@geositta

@geositta geositta commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Explanation

References

This PR adds the chart analytics property and value constants to the Perps controller analytics exports:

  • PERPS_EVENT_PROPERTY.CHART_LIBRARY
  • PERPS_EVENT_PROPERTY.ASSET_TYPE
  • PERPS_EVENT_VALUE.CHART_LIBRARY.ADVANCED
  • PERPS_EVENT_VALUE.CHART_LIBRARY.LIGHTWEIGHT
  • PERPS_EVENT_VALUE.ASSET_TYPE.PERP

The new constants are used by the Perps Advanced Charts migration to distinguish analytics emitted from the existing lightweight chart experience versus the new advanced chart experience.

asset_type: perp is included as a global analytics dimension for these chart events so Segment receives the same standardized value across Perps clients.

The related mobile changes replace local chart analytics constants with these controller exports. The related segment-schema changes ensure the emitted properties are accepted by the analytics schema.

The downstream mobile PR needs to consume the updated @metamask/perps-controller package so it can use these canonical analytics constants instead of local string literals.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Additive analytics constants and an optional trade event property; no trading, auth, or persistence behavior changes.

Overview
Adds canonical Perps advanced chart analytics keys to @metamask/perps-controller so mobile can stop duplicating string literals: PERPS_EVENT_PROPERTY.CHART_LIBRARY / ASSET_TYPE and PERPS_EVENT_VALUE groups for chart library (lightweight, advanced) and asset type (spot, perp). Changelog documents the export for the Advanced Charts migration (#9221).

Trade path: TrackingData gains optional chartLibrary, and TradingService forwards it on Perp Trade Transaction events as chart_library when callers set it on order trackingData (e.g. trades initiated from the advanced chart). Unit tests cover the new constants and the trade analytics property.

Reviewed by Cursor Bugbot for commit 4aa3b67. Bugbot is set up for automated code reviews on this repo. Configure here.

@geositta geositta force-pushed the perps/trading-service-events branch from 568f36c to 9de9aa4 Compare June 23, 2026 03:28
@geositta

Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-previews

@github-actions

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.5.2-preview-9de9aa4
@metamask-previews/accounts-controller@39.0.2-preview-9de9aa4
@metamask-previews/address-book-controller@7.1.2-preview-9de9aa4
@metamask-previews/ai-controllers@0.7.0-preview-9de9aa4
@metamask-previews/analytics-controller@1.1.1-preview-9de9aa4
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-9de9aa4
@metamask-previews/announcement-controller@8.1.0-preview-9de9aa4
@metamask-previews/app-metadata-controller@2.0.1-preview-9de9aa4
@metamask-previews/approval-controller@9.0.2-preview-9de9aa4
@metamask-previews/assets-controller@9.0.2-preview-9de9aa4
@metamask-previews/assets-controllers@109.2.1-preview-9de9aa4
@metamask-previews/authenticated-user-storage@2.1.0-preview-9de9aa4
@metamask-previews/base-controller@9.1.0-preview-9de9aa4
@metamask-previews/base-data-service@0.1.3-preview-9de9aa4
@metamask-previews/bitcoin-regtest-up@0.0.0-preview-9de9aa4
@metamask-previews/bridge-controller@76.0.0-preview-9de9aa4
@metamask-previews/bridge-status-controller@72.2.0-preview-9de9aa4
@metamask-previews/build-utils@3.0.4-preview-9de9aa4
@metamask-previews/chain-agnostic-permission@1.6.2-preview-9de9aa4
@metamask-previews/chomp-api-service@3.1.0-preview-9de9aa4
@metamask-previews/claims-controller@0.5.3-preview-9de9aa4
@metamask-previews/client-controller@1.0.1-preview-9de9aa4
@metamask-previews/compliance-controller@2.1.0-preview-9de9aa4
@metamask-previews/composable-controller@12.0.1-preview-9de9aa4
@metamask-previews/config-registry-controller@0.4.1-preview-9de9aa4
@metamask-previews/connectivity-controller@0.2.0-preview-9de9aa4
@metamask-previews/controller-utils@12.3.0-preview-9de9aa4
@metamask-previews/core-backend@6.3.3-preview-9de9aa4
@metamask-previews/delegation-controller@3.0.2-preview-9de9aa4
@metamask-previews/earn-controller@12.2.1-preview-9de9aa4
@metamask-previews/eip-5792-middleware@3.0.4-preview-9de9aa4
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.1-preview-9de9aa4
@metamask-previews/eip1193-permission-middleware@2.0.1-preview-9de9aa4
@metamask-previews/ens-controller@19.1.4-preview-9de9aa4
@metamask-previews/eth-block-tracker@15.0.1-preview-9de9aa4
@metamask-previews/eth-json-rpc-middleware@23.1.3-preview-9de9aa4
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-9de9aa4
@metamask-previews/foundryup@1.0.1-preview-9de9aa4
@metamask-previews/gas-fee-controller@26.2.3-preview-9de9aa4
@metamask-previews/gator-permissions-controller@4.2.1-preview-9de9aa4
@metamask-previews/geolocation-controller@0.1.3-preview-9de9aa4
@metamask-previews/java-tron-up@0.0.0-preview-9de9aa4
@metamask-previews/json-rpc-engine@10.5.0-preview-9de9aa4
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-9de9aa4
@metamask-previews/keyring-controller@27.1.0-preview-9de9aa4
@metamask-previews/logging-controller@8.0.2-preview-9de9aa4
@metamask-previews/message-manager@14.1.2-preview-9de9aa4
@metamask-previews/messenger@1.2.0-preview-9de9aa4
@metamask-previews/messenger-cli@0.2.0-preview-9de9aa4
@metamask-previews/money-account-balance-service@2.1.1-preview-9de9aa4
@metamask-previews/money-account-controller@0.3.3-preview-9de9aa4
@metamask-previews/money-account-upgrade-controller@2.1.0-preview-9de9aa4
@metamask-previews/multichain-account-service@10.0.3-preview-9de9aa4
@metamask-previews/multichain-api-middleware@3.1.5-preview-9de9aa4
@metamask-previews/multichain-network-controller@3.1.4-preview-9de9aa4
@metamask-previews/multichain-transactions-controller@7.1.1-preview-9de9aa4
@metamask-previews/name-controller@9.1.2-preview-9de9aa4
@metamask-previews/network-controller@33.0.0-preview-9de9aa4
@metamask-previews/network-enablement-controller@5.4.0-preview-9de9aa4
@metamask-previews/notification-services-controller@24.2.0-preview-9de9aa4
@metamask-previews/passkey-controller@2.0.1-preview-9de9aa4
@metamask-previews/permission-controller@13.1.1-preview-9de9aa4
@metamask-previews/permission-log-controller@5.1.0-preview-9de9aa4
@metamask-previews/perps-controller@8.2.0-preview-9de9aa4
@metamask-previews/phishing-controller@17.2.0-preview-9de9aa4
@metamask-previews/polling-controller@16.0.7-preview-9de9aa4
@metamask-previews/preferences-controller@23.1.0-preview-9de9aa4
@metamask-previews/profile-metrics-controller@4.0.0-preview-9de9aa4
@metamask-previews/profile-sync-controller@28.2.0-preview-9de9aa4
@metamask-previews/ramps-controller@14.3.0-preview-9de9aa4
@metamask-previews/rate-limit-controller@7.0.1-preview-9de9aa4
@metamask-previews/react-data-query@0.2.1-preview-9de9aa4
@metamask-previews/remote-feature-flag-controller@4.2.2-preview-9de9aa4
@metamask-previews/sample-controllers@5.0.2-preview-9de9aa4
@metamask-previews/seedless-onboarding-controller@10.0.2-preview-9de9aa4
@metamask-previews/selected-network-controller@26.1.4-preview-9de9aa4
@metamask-previews/shield-controller@5.1.2-preview-9de9aa4
@metamask-previews/signature-controller@39.2.6-preview-9de9aa4
@metamask-previews/smart-transactions-controller@24.2.3-preview-9de9aa4
@metamask-previews/snap-account-service@0.3.1-preview-9de9aa4
@metamask-previews/social-controllers@2.3.1-preview-9de9aa4
@metamask-previews/solana-test-validator-up@0.0.0-preview-9de9aa4
@metamask-previews/storage-service@1.0.2-preview-9de9aa4
@metamask-previews/subscription-controller@6.2.0-preview-9de9aa4
@metamask-previews/transaction-controller@68.1.1-preview-9de9aa4
@metamask-previews/transaction-pay-controller@23.14.0-preview-9de9aa4
@metamask-previews/user-operation-controller@41.2.5-preview-9de9aa4
@metamask-previews/wallet@4.0.0-preview-9de9aa4
@metamask-previews/wallet-cli@0.0.0-preview-9de9aa4

@geositta geositta force-pushed the perps/trading-service-events branch from 9de9aa4 to c141272 Compare June 23, 2026 19:42
@geositta geositta marked this pull request as ready for review June 23, 2026 19:47
@geositta geositta requested review from a team as code owners June 23, 2026 19:47
@geositta geositta temporarily deployed to default-branch June 23, 2026 19:47 — with GitHub Actions Inactive
@geositta geositta force-pushed the perps/trading-service-events branch from 93d74b9 to 26fc963 Compare June 23, 2026 23:08
@geositta geositta enabled auto-merge June 24, 2026 00:08
@geositta geositta force-pushed the perps/trading-service-events branch from 9a4d21f to 4aa3b67 Compare June 24, 2026 12:56
@geositta geositta added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit 806c1a4 Jun 24, 2026
400 of 408 checks passed
@geositta geositta deleted the perps/trading-service-events branch June 24, 2026 13:03
pull Bot pushed a commit to Reality2byte/core that referenced this pull request Jun 24, 2026
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR moves the Perps Advanced Chart analytics changelog entry for
MetaMask#9221 from the released 9.0.0 section back into Unreleased.

The original PR introduced user-facing/API-facing analytics constants in
@metamask/perps-controller, so the changelog entry needs to remain under
Unreleased until it is picked up by the next package release.

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only changelog reordering with no runtime or API code
changes in this PR.
> 
> **Overview**
> **Changelog-only fix** for `@metamask/perps-controller`: the **Perps
Advanced Chart analytics** note
([MetaMask#9221](MetaMask#9221)) is moved out of
**`[9.0.0]`** and into **`[Unreleased]` → Added**.
> 
> The entry text is unchanged (new `PERPS_EVENT_PROPERTY` keys
`CHART_LIBRARY` / `ASSET_TYPE` and matching `PERPS_EVENT_VALUE` groups).
**`[9.0.0]`** now only documents the watchlist/AUS breaking changes
([MetaMask#9010](MetaMask#9010)).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fe9d324. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants