Skip to content

🐛 Fix Shopify Custom Pixel actions being marked as background events, flatten ui_extension_errored context - #4946

Open
lierniel wants to merge 3 commits into
mainfrom
stephan.koshcheev/RUM-18056/shopify-ui-extension-error-shape-and-focus-fix
Open

🐛 Fix Shopify Custom Pixel actions being marked as background events, flatten ui_extension_errored context#4946
lierniel wants to merge 3 commits into
mainfrom
stephan.koshcheev/RUM-18056/shopify-ui-extension-error-shape-and-focus-fix

Conversation

@lierniel

@lierniel lierniel commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Motivation

RUM-18056

Two related fixes to the Shopify Custom Pixel integration:

  1. Clicks tracked via startAction/stopAction in the Custom Pixel sandbox were always being reported with view.in_foreground: false. The pixel runs in a sandboxed iframe with no focusable UI, so document.hasFocus() always returns false there, which pageStateHistory.ts interprets as the page being backgrounded — even when the customer is actively on the checkout page.
  2. Addresses review feedback on #4878: the ui_extension_errored error context nested an extension: { name, target, type, appName } object whose type field read as the same concept as the SDK's own error-name-derived type, but is actually an unrelated Shopify UiExtensionErrorType enum (e.g. EXTENSION_USAGE_ERROR).

Changes

  • patchSandboxedIframeApis.ts: shims document.hasFocus() to always return true inside the Custom Pixel sandbox, alongside the existing cookieStore/navigator.locks/contentWindow shims for that same sandboxed context.
  • shopifyBindings.ts: flattens the ui_extension_errored context and renames type to extensionErrorType to disambiguate it from the SDK's own error type. Also forwards appId and appVersion, which Shopify includes on the error payload but weren't previously captured.
  • Updated shopifyBindings.spec.ts for the new flattened shape.

Test instructions

  • yarn test:unit --spec packages/browser-rum-shopify/src/domain/shopifyBindings.spec.ts passes

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 180.44 KiB 180.44 KiB 0 B 0.00%
Rum Profiler 8.43 KiB 8.43 KiB 0 B 0.00%
Rum Recorder 21.12 KiB 21.12 KiB 0 B 0.00%
Logs 57.04 KiB 57.04 KiB 0 B 0.00%
Rum Salesforce N/A 138.47 KiB N/A N/A N/A
Rum Slim 138.47 KiB 138.47 KiB 0 B 0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%
Rum Shopify N/A 200.16 KiB N/A N/A N/A
Rum-shopify Profiler N/A 8.43 KiB N/A N/A N/A
Rum-shopify Recorder N/A 3.72 KiB N/A N/A N/A

@datadog-official

datadog-official Bot commented Aug 13, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 77.19% (-0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d28d7cf | Docs | Datadog PR Page | Give us feedback!

@lierniel
lierniel marked this pull request as ready for review August 13, 2026 15:45
@lierniel
lierniel requested a review from a team as a code owner August 13, 2026 15:45
type: error?.type,
appName: error?.appName,
},
extensionName: error?.extensionName,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: usually we use snake_case for attributes

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