Commit 7b1455f
feat(snaps): Add integration for snap_trackEvent RPC method (#32554)
## **Description**
This PR adds integration for new Snap RPC method called
`snap_trackEvent`.
The implementation is done in Snaps repositories in the following PR:
MetaMask/snaps#3375
Method specification: https://metamask.github.io/SIPs/SIPS/sip-32
[](https://codespaces.new/MetaMask/metamask-extension/pull/32554?quickstart=1)
## **Related issues**
Fixes: MetaMask/snaps#3274
## **Manual testing steps**
1. Within some of the preinstalled Snaps use `snap_trackEvent` RPC
method and send some tracking data in format specified in
[SIP-32](https://metamask.github.io/SIPs/SIPS/sip-32).
2. Find a way and verify that the event is sent (intercept MetaMetrics
track event method or check with other e2e metrics testing utilities)
Example Snap code used for testing the method:
```typescript
await snap.request({
method: 'snap_trackEvent',
params: {
event: {
event: 'SnapExportUsed',
properties: {
export: 'onRpcRequest',
origin: 'https://metamask.io',
snap_category: null,
snap_id: 'npm:@metamask/example-snap',
success: true,
},
sensitiveProperties: {
transaction_hash: 'transaction-hash',
},
},
},
});
```
## **Screenshots/Recordings**
### **Before**
No UI changes (n/a).
### **After**
No UI changes (n/a).
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.1 parent df20fd7 commit 7b1455f
File tree
2 files changed
+4
-0
lines changed- app/scripts
- controllers/permissions
2 files changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7132 | 7132 | | |
7133 | 7133 | | |
7134 | 7134 | | |
| 7135 | + | |
| 7136 | + | |
| 7137 | + | |
7135 | 7138 | | |
7136 | 7139 | | |
7137 | 7140 | | |
| |||
0 commit comments