Kowal Sentry Integration for Magento 2
YOU CAN TRUST US
25 years of experience in e-commerce and Magento 2
Fast delivery
Efficient implementation process
Simple and transparent complaint process
Working with clients worldwide
Free module updates
Payment by bank transfer
Magento 2 and Sentry in one cohesive deployment
In e-commerce, fast error detection and root cause analysis directly impact revenue, customer experience quality, and store stability. Kowal_Sentry was built as a Magento 2 module that connects your store to Sentry without touching core files and while staying aligned with the platform architecture.
The module supports monitoring of key areas across the store:
- PHP backend errors,
- JavaScript errors on the storefront and in the admin panel,
- HTTP and AJAX request tracing,
- checkout monitoring and order placement flow visibility,
- cron monitoring and Sentry check-ins,
- CLI command monitoring,
- release tracking,
- frontend source maps,
- structured logs,
- Session Replay and User Feedback within a controlled scope.
This gives the engineering team a single observability point for the entire Magento 2 application.
Key benefits of the Magento 2 Sentry module
Faster error detection in Magento 2
Kowal_Sentry captures backend and frontend errors so issues become visible immediately after they happen. This covers PHP exceptions, JavaScript errors, RequireJS problems, unhandled promise rejections, and checkout-related failures.
Better store performance analysis
The module supports performance tracing for requests, AJAX calls, cron jobs, and CLI commands. This helps you identify slow processes, performance regressions, and bottlenecks in the most critical parts of Magento 2.
Checkout and sales flow monitoring
For online stores, the highest-value areas are those that directly impact conversion. Kowal_Sentry supports monitoring of checkout steps, payment selection, shipping selection, place order, and order-related flows. This is especially useful when diagnosing cart issues, payment failures, and order finalization problems.
Cron monitoring and operational observability
Many critical Magento 2 processes run in the background via cron. The module can monitor job execution, runtime, success or failure status, and report check-ins to Sentry. This improves control over sync processes, imports, exports, and store automation.
Secure integration with Magento data
The module was designed with data protection in mind. It supports customer data masking, blocking cookies and authorization headers, query parameter redaction, limiting POST bodies, and additional sanitization rules for checkout and payment fields.
What Kowal_Sentry monitors in Magento 2
PHP backend monitoring
The extension supports full initialization of the Sentry PHP SDK for:
- storefront HTTP,
- adminhtml,
- REST and GraphQL,
- cron,
- CLI,
- custom endpoints and integrations.
This enables reporting of exceptions, fatal errors, manual messages, and additional technical or business context.
JavaScript frontend monitoring
On the browser side, the module integrates Magento 2 with the Sentry Browser SDK and supports:
window.onerror,unhandledrejection,- RequireJS errors,
- AJAX breadcrumbs,
- load and interaction tracing,
- checkout instrumentation,
- Session Replay,
- User Feedback widget.
This approach works well both for classic Magento storefronts and for stores with a higher amount of custom scripts and widgets.
Magento 2 checkout monitoring
Checkout is one of the most critical areas of the store. Kowal_Sentry enables:
- tracking checkout steps,
- tagging payment and shipping methods,
- breadcrumbs for AJAX errors during checkout,
- reporting exceptions related to place order,
- better analysis of issues impacting conversion.
Cron and CLI monitoring
By integrating with background processes, the module helps analyze issues that are not always visible on the storefront:
- importer errors,
- failed integration syncs,
- long cron runtimes,
bin/magentocommand failures,- unstable asynchronous jobs.
Why this Magento 2 to Sentry module is production-ready
Kowal_Sentry is not a simple wrapper for sending exceptions. It is a carefully designed integration layer built according to Magento 2 best practices.
The module:
- does not modify core files,
- uses dependency injection, plugins, observers, and layout XML,
- supports configuration from the admin panel,
- works across local, dev, staging, and production environments,
- supports multistore,
- allows independent control of backend and frontend monitoring,
- implements privacy policy and data sanitization,
- supports release strategy and source map readiness.
This matters for teams that need a solution suitable for real production deployment, not only developer testing.
Core features of Kowal_Sentry
Error Monitoring for Magento 2
The module can report:
- unhandled exceptions,
- fatal errors,
- JavaScript errors,
- AJAX errors,
- manual
captureExceptionandcaptureMessage, - events related to checkout and orders.
Performance Monitoring Magento 2
Kowal_Sentry supports:
- backend request tracing,
- frontend request tracing,
- spans for HTTP calls and integrations,
- cron runtime monitoring,
- CLI command monitoring,
- performance correlation with release and environment.
Structured Logs and observability
The module provides a facade for structured logs, allowing Sentry to function not only as an error repository but also as a central correlation point for logs, traces, and exception events.
Session Replay and User Feedback
On the frontend, the solution supports a cautious rollout of Session Replay with data masking and an end-user feedback widget. This improves understanding of issues occurring in real user sessions.
Data security and privacy
Monitoring in e-commerce must consider protection of personal and operational data. Kowal_Sentry was built with secure defaults in mind.
By default, the module supports:
- customer data masking,
- blocking Authorization headers,
- blocking cookies,
- removing POST bodies,
- query parameter redaction,
- masking checkout fields,
- masking payment-related fields,
- controlling the data scope sent to Replay.
This helps deploy Sentry integration in a more responsible way aligned with organizational requirements.
Who Kowal_Sentry is for
This solution is designed for:
- Magento 2 stores running in production,
- software houses maintaining Magento stores,
- DevOps teams and backend frontend developers,
- companies implementing observability in e-commerce,
- organizations needing better control over checkout, integrations, and performance issues.
The module fits both a single store and multistore installations with more complex business processes.
Summary
Kowal_Sentry is an advanced Magento 2 module for Sentry integration that combines error tracking, performance monitoring, cron monitoring, checkout observability, and safe data sanitization. It is built for organizations that want to improve store stability, diagnose problems faster, and better control Magento 2 quality in production.
If you are looking for a Magento 2 Sentry integration, Magento 2 error monitoring, Magento performance monitoring, or Magento 2 checkout monitoring, Kowal_Sentry is designed for that exact scenario.
Kowal_Sentry installation and configuration guide
Module goal
Kowal_Sentry integrates Magento 2 with Sentry and allows you to monitor:
- PHP backend errors,
- JavaScript errors on the storefront and optionally in the admin panel,
- HTTP, CLI, and cron transactions,
- checkout breadcrumbs,
- Session Replay,
- User Feedback,
- release tracking and source map readiness.
The module is distributed as a Composer package and should run from vendor/kowal/module-sentry.
Requirements
- Magento Open Source / Adobe Commerce 2.4.x
- PHP 8.1+
- access to Sentry and at least one project
- GitHub token if the repository is installed via a private
vcs
Installation
The commands below were copied from README.md.
composer config repositories.sentry vcs https://github.com/kowalco/sentrycomposer config --global --auth github-oauth.github.com <YOUR_TOKEN>composer require kowal/module-sentrybin/magento module:enable Kowal_Sentrybin/magento setup:upgradebin/magento cache:flushImportant
- The Composer package should work only from
vendor/kowal/module-sentry. - Do not keep the same module simultaneously in
app/code/Kowal/Sentry. - After installation, configuration can be found at:
Stores -> Configuration -> Kowal -> Sentry
Quick start
Minimal configuration required to start the module:
- Set
Enable Module = Yes. - Set
Environment, for exampleproductionorstaging. - Enable
Enable Backend Monitoringand paste theBackend DSN. - If you want frontend monitoring, enable
Enable Frontend Monitoringand paste theFrontend DSN. - Save configuration and clear cache if required in your environment.
Where to get Sentry settings
DSN
You can usually find DSN here:
Settings -> Projects -> [project] -> Client Keys (DSN)
For Backend DSN and Frontend DSN, paste only the DSN URL itself, for example:
https://examplePublicKey@o0000000000000000.ingest.de.sentry.io/0000000000000000Do not paste the full snippet:
Sentryinit([ 'dsn' => 'https://examplePublicKey@o0000000000000000.ingest.de.sentry.io/0000000000000000',]);Organization
The organization slug is easiest to read from the Sentry URL, for example:
https://sentry.io/settings/acme/projects/shop-frontend/
In this example:
acmeis theOrganizationshop-frontendis theProject Slug
Project Slug
You can read it:
- from the project URL in Sentry,
- or from
Settings -> Projects -> [project] -> Details.
Auth token for source maps
If you use sentry-cli, it is best to keep the token outside Magento, for example in an environment variable:
SENTRY_AUTH_TOKEN
Token creation:
Settings -> Custom Integrations- or
User Settings -> Personal Tokens.
Post-install verification
After basic configuration, you can verify that the module is active and the SDK works. The smoke-test commands below were copied from README.md.
After enabling Enable Test Commands:
bin/magento kowal:sentry:test:errorbin/magento kowal:sentry:test:transactionbin/magento kowal:sentry:test:checkinbin/magento kowal:sentry:test:logConfiguration in Magento Admin
Path:
Stores -> Configuration -> Kowal -> Sentry
Below is an explanation of each section, available options, and configuration variants.
General section
This section controls module activation, environment, and how release is calculated.
Enable Module
Yesenables the module globally.Nodisables backend and frontend initialization even if other options are enabled.
Recommendation:
- Use
Yesin environments where you want to send data to Sentry.
Environment
Examples:
productionstagingdevelopment
Variants:
- one shared name for the entire instance,
- different values per website or store view if you need to split events.
Recommendation:
- avoid spaces and slashes,
- keep naming consistent between backend, frontend, and CI/CD.
Release Strategy
Available variants:
manualrelease is taken fromRelease Name Overrideenvrelease is taken from environment variablesfilerelease is read from a filegeneratedrelease is composed automatically by the module
When to use:
manualwhen you want to set release manually, typically for simple deploymentsenvbest for CI/CD where release is passed by the deploymentfilegood when deployment writes a version identifier into a shared filegeneratedgood as a starting point if you do not have a mature release pipeline yet
Supported environment variables:
KOWAL_SENTRY_RELEASESENTRY_RELEASERELEASE_NAMEGIT_COMMIT
Release Name Override
Used only with manual strategy.
Example:
magento-store@2.4.7-p1+20260410.1
Recommendation:
- use the exact same value when uploading source maps.
Project Name
An auxiliary project name used in module contexts. This is not the Sentry Project Slug.
Variants:
- store instance name,
- store group name,
- internal project name.
Debug Mode
Yesenables more verbose diagnostic loggingNoproduction mode
Recommendation:
Noin production,Yestemporarily when diagnosing configuration.
Enable Test Commands
Yesexposes test commands inbin/magentoNohides them during normal operation
Recommendation:
Yeson staging or during testing,Nofor a permanent production setup.
Backend SDK section
Applies to the PHP SDK used by storefront HTTP, admin, API, cron, and CLI.
Enable Backend Monitoring
Yesenables backend monitoringNobackend will not send errors or traces to Sentry
Backend DSN
The primary DSN for the PHP SDK.
Variants:
- a separate Sentry project for backend only
- the same project for both backend and frontend
Recommendation:
- for mature deployments, keep separate backend and frontend projects,
- for smaller installations, you can start with a single shared project.
Error Sample Rate
Range: 0-1
Examples:
1send all errors0.5send about half0.25send about 25 percent
Recommendation:
- typically
1.0for errors, at least at the beginning.
Trace Sample Rate
Range: 0-1
Examples:
0.05low sampling, good for high-traffic production0.1reasonable starting point0.2more data at higher volume cost
Recommendation:
- in production usually
0.05-0.2, depending on traffic and Sentry plan.
Profile Sample Rate
Range: 0-1
Variants:
0profiling disabled- low value such as
0.01periodic performance diagnostics
Recommendation:
0or a very low value in production.
Enable Logs
Yessends structured logsNono logs in Sentry
When to enable:
- when you want to correlate logs with traces and errors.
Enable Metrics API
Yesenables the module metrics facadeNomodule-side metrics will not be active
Note:
- current
sentry/sentry 4.24.xtreats backend metrics as a deprecated API and a no-op.
Enable Cron Monitoring
Yessends cron check-ins and transactionsNocron jobs will not be monitored by Sentry
You can find the data in Sentry under:
CronsMonitors
Enable CLI Monitoring
Yesmonitorsbin/magentocommandsNono CLI process monitoring
Useful for:
- imports,
- reindexing,
- custom integration commands.
Enable Adminhtml Monitoring
Yesmonitors admin panel requestsNolimits backend to storefront, API, cron, and CLI
Enable API Monitoring
Yesmonitors REST, GraphQL, and other endpointsNodisables the integration layer from monitoring
Frontend SDK section
Applies to the Browser SDK loaded on the storefront and optionally in the admin panel.
Enable Frontend Monitoring
Yesloads the Browser SDKNofrontend will not send data to Sentry
Frontend DSN
Variants:
- a separate frontend project
- the same DSN as backend
- empty field so the module tries to fall back to
Backend DSN
Recommendation:
- ideally a separate frontend project for clear Issues, Replay, and Performance.
Enable Storefront JS
YesBrowser SDK runs on the storefrontNono SDK on the public site
Enable Admin JS
YesBrowser SDK also runs in adminNoJS monitoring is limited to storefront
Recommendation:
- enable only when you actually need to diagnose JS issues in admin.
JS Trace Sample Rate
Range: 0-1
Examples:
0.01very cautious0.05good production starting point0.1more data, higher volume
JS Replay Session Sample Rate
Range: 0-1
Examples:
0no full replays0.01safe start0.05more data for UX and error analysis
JS Replay On Error Sample Rate
Range: 0-1
Examples:
1replay after every error in a session0.5replay for a portion of error sessions
Recommendation:
- often a better starting point than high sampling for all sessions.
Enable Session Replay
Yesenables ReplayNono session recording
Recommendation:
- enable together with strong masking for checkout and payments.
Enable User Feedback Widget
YesFeedback widget is availableNowidget is not loaded
Note:
- depending on Sentry plan and account, this feature may be marked beta or experimental.
Enable Checkout Instrumentation
Yesadds checkout breadcrumbs and tagsNono additional checkout context
Recommendation:
- typically worth keeping enabled.
Enable Ajax Instrumentation
Yesbreadcrumbs for AJAX, fetch, XHRNoless context for frontend issues
Browser SDK CDN URL
By default it points to the official Sentry bundle.
Variants:
- module default URL
- custom CDN mirror
- pinned bundle or pinned version
Change only if:
- you pin SDK versions,
- you have custom CSP rules,
- you mirror assets.
Privacy / Security section
This section minimizes the risk of sending sensitive data.
Send Default PII
YesSDK may send the default set of user and request dataNomore conservative privacy policy
Recommendation:
- usually
No.
Anonymize IP
Yesdo not send the full IP addressNokeep default behavior
Recommendation:
- usually
Yes.
Mask Customer Data
Yesmasks customer dataNoless data protection
Recommendation:
- almost always
Yesin production.
Mask Checkout Fields
Yesmasks checkout fieldsNorisk of data leakage from checkout
Recommendation:
- always
Yes.
Mask Payment Fields
Yesmasks payment-related fieldsNovery risky
Recommendation:
- always
Yes.
Block Authorization Headers
Yesremoves or masksAuthorizationand tokensNorisk of sending authentication data
Recommendation:
- always
Yes.
Block Cookies
Yesremoves cookies from event dataNohigher risk of session data leakage
Recommendation:
- usually
Yes.
Block POST Bodies
YesremovesPOSTbodiesNosends more request data
Recommendation:
- usually
Yes, especially for checkout, login, and forms.
Redact Query Params
Yesmasks query string parametersNoquery string remains more readable but less secure
Additional Redacted Keys
Text field for additional keys to redact.
Examples:
tokenapi_keycustomer_emailexternal_customer_id
You can separate values by:
- commas,
- spaces,
- new lines.
Replay Mask Selectors
CSS selectors whose content should be masked in Replay.
Examples:
.customer-email.field[name*='password'].payment-method
Replay Block Selectors
CSS selectors that should be fully blocked in Replay.
Examples:
.checkout-container.payment-method iframe.opc-wrapper
Allowed Domains for Replay Network Details
List of domains for which Replay may attach network request details.
Examples:
store.example.comapi.example.comtrusted-partner.example
Recommendation:
- enter only your own and trusted domains.
Filtering section
This section reduces noise and event volume.
Ignore Exceptions Regex
One regex rule per line.
Typical use cases:
- known harmless technical errors,
- exceptions from external integrations already handled elsewhere.
Ignore URLs Regex
One regex rule per line.
Examples:
- health-check endpoints,
- test webhooks,
- technical assets.
Ignore Transactions
One transaction name per line.
Recommendation:
- collect data first,
- then filter low-value and repetitive transactions.
Ignore Bots
Yesfilters bots and crawlersNomonitors automated traffic as well
Recommendation:
Yesfor high SEO traffic.
Ignore Health Checks
Yesskips/health,/status,/ping, and similar routesNothose requests will be sent to Sentry
Ignore Admin Routes
Yesreduces events from adminNoadmin remains monitored
Ignore Static Resource Errors
Yesfilters some asset errors for.jsand.cssNoall such errors remain visible
Recommendation:
- usually
Yesif you do not want to flood the project with noise after deployments.
Context section
Controls how much business context is attached to events.
Attach Store Context
Yesattachesstore_id,store_code, store name, and currencyNono store context
Recommendation:
Yes, especially for multistore.
Attach Website Context
Yesattaches website dataNono website-level identification
Attach Customer Context
Yesattaches anonymized customer contextNono customer status data
Attach Quote Context
Yesattaches cart or quote contextNoless data for checkout diagnosis
Attach Cart Totals
Yesattaches cart totalsNolighter event payload
Recommendation:
- enable only if it truly helps your analysis.
Attach Order Context
Yesattaches order contextNono order flow data
Especially useful for:
- invoices,
- shipments,
- transactional emails,
- ERP or OMS integrations.
Attach Product Context
Yesattaches basic product contextNono product context
Attach Category Context
Yesattaches basic category contextNono category context
Attach Payment / Shipping Method
Yesattachespayment_methodandshipping_methodNoless checkout data
Recommendation:
- one of the most valuable diagnostic settings.
Attach Module Version
YesattachesKowal_SentryversionNono module version in events
Attach Magento Version
Yesattaches Magento versionNono platform context
Attach Deployment Metadata
Yesattaches extra deployment metadata if availableNono deployment metadata
Useful when you want to quickly link an issue to a rollout or a specific build.
Source Maps / Release section
This section organizes parameters needed for release and source maps. Upload should be done in CI/CD, not during Magento runtime.
Enable Source Map Upload
Yesconfirms you use source maps organizationallyNomodule will not assume source maps in configuration
Note:
- this is a configuration flag, not an upload mechanism.
Source Map Upload Mode
Variants:
manualmanualsentry-clicommandsciupload in CI/CD pipelinedeploy_hookupload in deployment hook
Recommendation:
- in production most often
ci.
Assets Base URL
Example:
https://store.example.com/static/frontend
This value must match what the Browser SDK sees in stack traces, otherwise source maps will not resolve.
Release Dist
Optional dist for the release.
Examples:
storefrontadminpl-store
Use when one release has multiple asset variants.
Organization
Organization slug used by sentry-cli and the API.
How to find it:
- from the Sentry URL,
- for example
https://sentry.io/settings/acme/projects/shop-frontend/->acme
Project Slug
Project slug used by the release and source maps workflow.
How to find it:
- from the project URL,
- or
Settings -> Projects -> [project] -> Details.
Release File Path
Path to the release name file when using file strategy.
Examples:
/var/www/shared/release.txtpub/media/deploy/release-id.txt
User Feedback section
Configuration for the in-browser issue reporting widget.
Widget Theme
Variants:
lightdarksystem
Recommendation:
- usually
system.
Widget Language
Examples:
pl-PLen-US
Recommendation:
- in multistore, match the store view locale.
Auto-open after selected errors
Yesafter selected frontend errors, a feedback prompt may appearNothe widget will not open automatically
Recommendation:
- use cautiously to avoid being too aggressive for users.
Show on checkout success
YesFeedback trigger may appear on the order success pageNono trigger in that location
Show on contact page
Yestrigger or widget on the contact pageNono exposure on contact page
Show in footer
Yesalways-visible trigger in the footer or as a persistent page elementNono persistent trigger
This is the simplest option if you want a Report an issue button.
Custom Trigger Selector
CSS selector of an existing element that opens Feedback.
Examples:
#report-issue.js-sentry-feedback
Use this field if you want to attach the widget to your own button in a layout or CMS block.
Cron Monitoring section
This section controls check-ins and monitors for Magento cron jobs.
Enable auto-registration of configured cron jobs
Yesthe first check-in may create or update the monitor in SentryNothe module sends check-ins without auto-configuring the monitor
Recommendation:
Yesif you have controlled deployments and deliberately defined jobs.
Monitored job codes
List of Magento job_code values.
You can separate values by:
- commas,
- spaces,
- new lines.
Variants:
- empty field monitor all cron jobs
- selected
job_codelist monitor only critical jobs
Examples:
sales_clean_quotescatalog_product_alertindexer_reindex_all_invalid
Timeout threshold per job
One rule per line:
job_code:minutes
Example:
catalog_product_alert:10
Use when a cron runs irregularly and you want to reduce false alerts.
Max runtime per job
One rule per line:
job_code:minutes
Example:
indexer_reindex_all_invalid:30
After exceeding the limit, Sentry may flag the monitor as unhealthy.
Check-in slug prefix
Example:
magento-
Useful when one Sentry organization monitors multiple Magento instances and you want to avoid naming collisions.
Recommended configuration profiles
Safe production start
Enable Module = YesEnable Backend Monitoring = YesEnable Frontend Monitoring = YesError Sample Rate = 1Trace Sample Rate = 0.05or0.1JS Trace Sample Rate = 0.01or0.05Enable Session Replay = YesJS Replay Session Sample Rate = 0.01JS Replay On Error Sample Rate = 1Send Default PII = NoAnonymize IP = YesMask Customer Data = YesMask Checkout Fields = YesMask Payment Fields = YesBlock Authorization Headers = YesBlock Cookies = YesBlock POST Bodies = YesRedact Query Params = YesIgnore Bots = YesIgnore Health Checks = Yes
Diagnostic profile for staging
- higher
Trace Sample Rate, for example0.2 - higher
JS Trace Sample Rate, for example0.1 - temporarily
Debug Mode = Yes Enable Test Commands = Yes- be cautious with Replay keep masking and blocks enabled
Minimal backend-only variant
Enable Backend Monitoring = YesBackend DSNfilled inEnable Frontend Monitoring = No
This is a good first step if you want to start with PHP exception and cron monitoring first.
Most common configuration mistakes
- Pasting the full
Sentryinit(...)snippet instead of only the DSN. - Keeping the module both in
vendor/andapp/code/at the same time. - Different
releasevalues between events and source maps. - Overly aggressive Replay sampling in production.
- Disabling checkout and payment masking.
- Leaving an example DSN in an active configuration.
Summary
The safest approach is to start with backend monitoring, cautious frontend monitoring, and strict privacy settings. Once Sentry data becomes stable and readable, you can gradually increase trace sampling, Replay, and business context scope.








