Kowal Sentry Integration for Magento 2
Magento Modules: Clear Guidelines
You purchase the module once, with no domain restrictions
Free installation and updates via Composer
Affiliate Program
Technical support for Magento
Clear guidelines for licensing Magento modules
Magento Module Code Security
Magento 2 and Sentry in one consistent implementation
In an e-commerce environment, fast error detection and root cause analysis have a direct impact on sales, customer service quality, and store stability. Kowal_Sentry was developed as a Magento 2 module that lets you connect your store with Sentry without modifying core files, while maintaining compatibility with the platform architecture.
The module supports monitoring of the most important areas of store operation:
- PHP backend errors,
- JavaScript errors on the storefront and in the admin panel,
- HTTP and AJAX request tracing,
- checkout and order placement process monitoring,
- cron monitoring and check-ins to Sentry,
- CLI command monitoring,
- release tracking,
- source maps for the frontend,
- structured logs,
- Session Replay and User Feedback within a controlled scope.
As a result, the technical team gets a single observation point for the entire Magento 2 application.
Key benefits of implementing the Magento 2 Sentry module
Faster error detection in Magento 2
Kowal_Sentry captures backend and frontend errors, making issues visible immediately after they occur. This applies to PHP exceptions as well as JavaScript errors, RequireJS issues, unhandled promise rejections, and checkout-related errors.
Better store performance analysis
The module supports performance tracing for requests, AJAX calls, crons, and CLI commands. This makes it possible to detect slow processes, performance regressions, and bottlenecks in key areas of a Magento 2 store.
Monitoring of checkout and sales processes
For online stores, the areas that directly affect conversion matter the most. Kowal_Sentry supports monitoring of checkout, payment selection, delivery, place order, and order-related processes. This is especially important when diagnosing issues with the cart, payments, and purchase completion.
Cron monitoring and observability of technical processes
Many important Magento 2 processes run in the background through cron. The module lets you monitor task startup, execution time, success or error status, and report check-ins to Sentry. This provides better control over store synchronizations, imports, exports, and automations.
Secure integration with Magento data
The module was designed with data protection in mind. It supports masking customer data, blocking cookies and authorization headers, redacting query params, limiting POST body content, and additional sanitization rules for checkout and payment fields.
What Kowal_Sentry monitors in Magento 2
PHP backend monitoring
The extension supports full PHP SDK initialization for:
- storefront HTTP,
- adminhtml,
- REST and GraphQL,
- cron,
- CLI,
- custom endpoints and integrations.
This makes it possible to report 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,
- breadcrumbs for AJAX,
- loading and interaction tracing,
- checkout instrumentation,
- Session Replay,
- User Feedback widget.
This solution works well both in a classic Magento storefront and in stores with more custom scripts and widgets.
Magento 2 checkout monitoring
Checkout is one of the most critical areas of a store. Kowal_Sentry enables:
- tracking checkout steps,
- tagging the payment and shipping method,
- breadcrumbs for AJAX errors in checkout,
- reporting exceptions related to place order,
- better analysis of issues that affect conversion.
Cron and CLI monitoring
Thanks to integration with background processes, the module helps analyze issues that are not always visible on the storefront:
- importer errors,
- failed integration synchronizations,
- long cron execution times,
bin/magentocommand errors,- unstable tasks executed asynchronously.
Why this Magento 2 module for Sentry is production-ready
Kowal_Sentry is not a simple wrapper for sending exceptions. It is a well-thought-out integration layer designed 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 in local, dev, staging, and production environments,
- supports multistore,
- lets you control the backend and frontend independently,
- takes privacy policy and data sanitization into account,
- supports release strategy and preparation for source maps.
This is important for teams looking for a solution suitable for a real implementation, not only for developer testing.
Main features of the Kowal_Sentry module
Error Monitoring for Magento 2
The module lets you report:
- unhandled exceptions,
- fatal errors,
- JavaScript errors,
- AJAX errors,
- manual
captureExceptionandcaptureMessage, - events related to checkout and orders.
Magento 2 Performance Monitoring
Kowal_Sentry supports:
- backend request tracing,
- frontend request tracing,
- spans for HTTP calls and integrations,
- cron execution time monitoring,
- CLI command monitoring,
- correlating performance with release and environment.
Structured Logs and observability
The module provides a facade for structured logs, allowing Sentry to serve not only as an error repository, but also as a central point for correlating logs, traces, and exception events.
Session Replay and User Feedback
On the frontend, the solution supports a careful implementation of Session Replay with data masking and a feedback widget for the end user. This makes it possible to better understand errors occurring in real user sessions.
Data security and privacy
Monitoring implementations in e-commerce must account for the protection of personal and operational data. Kowal_Sentry was developed with secure default configuration in mind.
By default, the module supports:
- customer data masking,
- blocking Authorization headers,
- blocking cookies,
- removing POST body content,
- redacting query params,
- masking checkout fields,
- masking payment-related fields,
- controlling the scope of data sent to Replay.
This allows the integration with Sentry to be implemented in a more responsible way and in line with organizational requirements.
Who the Kowal_Sentry module is for
This solution is intended for:
- production Magento 2 stores,
- software houses maintaining Magento stores,
- DevOps teams and backend/frontend developers,
- companies implementing observability in e-commerce,
- organizations that need better control over checkout, integration, and performance errors.
The module is suitable for both a single store and multistore installations with more complex business processes.
Summary
Kowal_Sentry is an advanced Magento 2 module for integration with Sentry that combines error tracking, performance monitoring, cron monitoring, checkout observability, and secure data sanitization. It is a solution for companies that want to increase store stability, diagnose issues faster, and better control the quality of Magento 2 operation in a production environment.
If you are looking for a Magento 2 Sentry integration, Magento 2 error monitoring, Magento performance monitoring, or Magento 2 checkout monitoring module, Kowal_Sentry is designed exactly for this scenario.
Kowal_Sentry: installation and configuration guide
Module purpose
Kowal_Sentry integrates Magento 2 with Sentry and lets you 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 preparation for source maps.
The module was prepared as a Composer package and should run from the vendor/kowal/module-sentry location.
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 through 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 composer require kowal/module-sentrybin/magento module:enable Kowal_Sentrybin/magento setup:upgradebin/magento cache:flush Important
- The Composer package is intended to work only from
vendor/kowal/module-sentry. - Do not keep the same module in
app/code/Kowal/Sentryat the same time. - After installation, you can find the configuration at:
Stores -> Configuration -> Kowal -> Sentry
Quick start
Minimum configuration required to run the module:
- Set
Enable Module = Yes. - Set
Environment, for exampleproductionorstaging. - Enable
Enable Backend Monitoringand paste theBackend DSN. - If you want to monitor the frontend, enable
Enable Frontend Monitoringand paste theFrontend DSN. - Save the configuration and clear the cache if needed in the given environment.
Where to get the data from Sentry
DSN
You can usually find the DSN here:
Settings -> Projects -> [projekt] -> Client Keys (DSN)
In the Backend DSN and Frontend DSN fields, paste only the DSN URL itself, for example:
https://examplePublicKey@o0000000000000000.ingest.de.sentry.io/0000000000000000Do not paste the entire snippet:
Sentryinit([ 'dsn' => 'https://examplePublicKey@o0000000000000000.ingest.de.sentry.io/0000000000000000',]);Organization
The organization slug is easiest to read from the URL of the Sentry panel, for example:
https://sentry.io/settings/acme/projects/shop-frontend/
In this example:
acmeisOrganizationshop-frontendisProject Slug
Project Slug
You can read it from:
- the project URL in the Sentry panel,
- or from
Settings -> Projects -> [projekt] -> 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
Creating a token:
Settings -> Custom Integrations- or
User Settings -> Personal Tokens
Verification after installation
After basic configuration, you can check whether the module is active and whether 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 the Magento panel
Path:
Stores -> Configuration -> Kowal -> Sentry
Below is a description of each section, its capabilities, and setting variants.
General section
This section controls module activation, the environment, and how release is calculated.
Enable Module
Yes: enables the module globally.No: the backend and frontend will not be initialized, even if other options are enabled.
Recommendation:
Yesin the environment where you want to send data to Sentry.
Environment
Examples:
productionstagingdevelopment
Variants:
- one shared name for the entire instance,
- different values per website/store view if you need to separate events.
Recommendation:
- no spaces and no slashes,
- keep consistent naming between the backend, frontend, and CI/CD.
Release Strategy
Available variants:
manual: release comes from theRelease Name Overridefieldenv: release is loaded from environment variablesfile: release is read from a filegenerated: release is assembled automatically by the module
When to use:
manual: when you want to enter the release manually, usually as a fallback or in simple deploymentsenv: best for CI/CD when the release is passed by deploymentfile: good when deployment writes the version identifier to a shared filegenerated: good for getting started 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 the manual strategy.
Example:
magento-store@2.4.7-p1+20260410.1
Recommendation:
- the exact same value should be used when uploading source maps.
Project Name
Auxiliary project name in module contexts. This is not the Sentry Project Slug.
Variants:
- store instance name,
- store group name,
- internal project name.
Debug Mode
Yes: more verbose diagnostic loggingNo: production mode
Recommendation:
Noin production,Yestemporarily when diagnosing the configuration.
Enable Test Commands
Yes: makes testbin/magentocommands availableNo: hides them during normal operation
Recommendation:
Yeson staging or during testing,Noin the permanent production configuration.
Backend SDK section
Applies to the PHP SDK used by storefront HTTP, admin, API, cron, and CLI.
Enable Backend Monitoring
Yes: enables backend monitoringNo: the backend does not send errors and traces to Sentry
Backend DSN
This is the primary DSN for the PHP SDK.
Variants:
- separate Sentry project only for the backend
- the same project for the backend and frontend
Recommendation:
- in more mature implementations, keep separate backend and frontend projects,
- in smaller installations, you can start with one shared project.
Error Sample Rate
Range: 0-1
Examples:
1: send all errors0.5: send about half0.25: send about 25%
Recommendation:
- usually
1.0for errors, at least at the beginning.
Trace Sample Rate
Range: 0-1
Examples:
0.05: low sampling, good for production with high traffic0.1: a reasonable starting point0.2: more data at the cost of volume
Recommendation:
- in production, usually
0.05-0.2, depending on traffic and the Sentry plan.
Profile Sample Rate
Range: 0-1
Variants:
0: profiling disabled- low value, for example
0.01: periodic performance diagnostics
Recommendation:
0or a very low value in production.
Enable Logs
Yes: sends structured logsNo: no logs in Sentry
When to enable:
- when you want to correlate logs with traces and errors.
Enable Metrics API
Yes: enables the module facade for metricsNo: metrics on the module side will not be active
Note:
- the current
sentry/sentry 4.24.xtreats backend metrics as a deprecated /no-opAPI.
Enable Cron Monitoring
Yes: sends cron check-ins and transactionsNo: crons will not be monitored by Sentry
You can find the data in Sentry in the section:
CronsMonitors
Enable CLI Monitoring
Yes: monitorsbin/magentocommandsNo: no CLI process monitoring
Useful for:
- imports,
- reindexing,
- custom integration commands.
Enable Adminhtml Monitoring
Yes: monitors admin panel requestsNo: limits the backend to the storefront, API, cron, and CLI
Enable API Monitoring
Yes: monitors REST, GraphQL, and other endpointsNo: excludes the integration part from monitoring
Frontend SDK section
Applies to the Browser SDK loaded on the storefront and optionally in the admin panel.
Enable Frontend Monitoring
Yes: loads the Browser SDKNo: the frontend does not send data to Sentry
Frontend DSN
Variants:
- separate frontend project
- the same DSN as the backend
- empty field so the module can try to fall back to
Backend DSN
Recommendation:
- ultimately, use a separate frontend project if you want clear Issues, Replay, and Performance.
Enable Storefront JS
Yes: Browser SDK runs on the storefrontNo: no SDK on the public part of the store
Enable Admin JS
Yes: Browser SDK also runs in the admin panelNo: JS monitoring is limited to the storefront
Recommendation:
- enable only when you are actually diagnosing JS issues in the admin.
JS Trace Sample Rate
Range: 0-1
Examples:
0.01: very cautious0.05: good start for production0.1: more data, higher volume
JS Replay Session Sample Rate
Range: 0-1
Examples:
0: no full replays0.01: safe start0.05: more data for UX and error analysis
JS Replay On Error Sample Rate
Range: 0-1
Examples:
1: replay after every error in the session0.5: replay after some errors
Recommendation:
- often a better start than high sampling of all sessions.
Enable Session Replay
Yes: enables ReplayNo: no session recording
Recommendation:
- enable together with strong masking of checkout and payment data.
Enable User Feedback Widget
Yes: the Feedback widget is availableNo: the widget is not loaded
Note:
- depending on the Sentry plan and account, the feature may be marked as beta / experimental.
Enable Checkout Instrumentation
Yes: adds checkout breadcrumbs and tagsNo: no additional checkout context
Recommendation:
- it is usually worth leaving enabled.
Enable Ajax Instrumentation
Yes: breadcrumbs for AJAX / fetch / XHRNo: less context for frontend issues
Browser SDK CDN URL
By default, it points to the official Sentry bundle.
Variants:
- default module URL
- custom CDN mirror
- pinned specific bundle / specific version
Change only when:
- you pin the SDK version,
- you have custom CSP rules,
- you use asset mirroring.
Privacy / Security section
This section is responsible for minimizing the risk of sending sensitive data.
Send Default PII
Yes: the SDK may send the default set of user and request dataNo: more conservative privacy policy
Recommendation:
- usually
No.
Anonymize IP
Yes: do not send the full IPNo: keep the standard behavior
Recommendation:
- usually
Yes.
Mask Customer Data
Yes: masks customer dataNo: less data protection
Recommendation:
- almost always
Yesin production.
Mask Checkout Fields
Yes: masks checkout fieldsNo: risk of checkout data leakage
Recommendation:
- always
Yes.
Mask Payment Fields
Yes: masks payment-related fieldsNo: very risky
Recommendation:
- always
Yes.
Block Authorization Headers
Yes: removes or masksAuthorizationand tokensNo: risk of sending authentication data
Recommendation:
- always
Yes.
Block Cookies
Yes: removes cookies from event dataNo: higher risk of session data leakage
Recommendation:
- usually
Yes.
Block POST Bodies
Yes: removesPOSTbodiesNo: sends more request data
Recommendation:
- usually
Yes, especially for checkout, login, and forms.
Redact Query Params
Yes: masks query string parametersNo: the query 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 them with:
- 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 include network request details.
Examples:
store.example.comapi.example.comtrusted-partner.example
Recommendation:
- enter only your own and trusted domains.
Filtering section
This section limits noise and event volume.
Ignore Exceptions Regex
One regex rule per line.
Use case examples:
- known, harmless technical errors,
- exceptions from external integrations that are already handled differently.
Ignore URLs Regex
One regex rule per line.
Examples:
- health-check endpoints,
- test webhooks,
- technical resources.
Ignore Transactions
One transaction name per line.
Recommendation:
- collect data first,
- then filter out low-value and repetitive transactions.
Ignore Bots
Yes: cuts off bot and crawler trafficNo: you also monitor automated traffic
Recommendation:
Yesfor high SEO traffic.
Ignore Health Checks
Yes: skips/health,/status,/ping, and similar requestsNo: such requests are sent to Sentry
Ignore Admin Routes
Yes: limits admin eventsNo: admin remains monitored
Ignore Static Resource Errors
Yes: filters some asset errors for.jsand.cssNo: all errors of this type remain visible
Recommendation:
- usually
Yesif you do not want to fill the project with noise after deployments.
Context section
Controls the amount of business context added to events.
Attach Store Context
Yes: attachesstore_id,store_code, store name, and currencyNo: no this context
Recommendation:
Yes, especially for multistore.
Attach Website Context
Yes: attaches website dataNo: no this level of identification
Attach Customer Context
Yes: attaches anonymized customer contextNo: no customer status data
Attach Quote Context
Yes: attaches cart / quote contextNo: less data for checkout diagnosis
Attach Cart Totals
Yes: attaches cart totalsNo: lighter event
Recommendation:
- enable only when this data actually helps with analysis.
Attach Order Context
Yes: attaches order contextNo: no data about the order flow
Especially useful for:
- invoice,
- shipment,
- transactional emails,
- ERP / OMS integrations.
Attach Product Context
Yes: attaches basic product contextNo: no this context
Attach Category Context
Yes: attaches basic category contextNo: no this context
Attach Payment / Shipping Method
Yes: attachespayment_methodandshipping_methodNo: less data for checkout
Recommendation:
- this is one of the more valuable diagnostic settings.
Attach Module Version
Yes: attaches theKowal_SentryversionNo: no this information in events
Attach Magento Version
Yes: attaches the Magento versionNo: no platform context
Attach Deployment Metadata
Yes: attaches additional deployment data if availableNo: no this metadata
Useful when you want to quickly connect an issue with a rollout or a specific build.
Source Maps / Release section
This section organizes the parameters needed for release and source maps. The upload itself should happen in CI/CD, not during Magento runtime.
Enable Source Map Upload
Yes: confirms that you organizationally use source mapsNo: the module does not assume source maps in the configuration
Note:
- this is a configuration flag, not an upload mechanism.
Source Map Upload Mode
Variants:
manual: manualsentry-clicommandsci: upload in the CI/CD pipelinedeploy_hook: upload in a 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 the stack trace. Otherwise, source maps will not be matched.
Release Dist
Optional dist for release.
Examples:
storefrontadminpl-store
Use when one release has several asset variants.
Organization
Organization slug used by sentry-cli and API.
How to find it:
- from the Sentry panel 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 -> [projekt] -> Details
Release File Path
Path to the file with the release name for the file strategy.
Examples:
/var/www/shared/release.txtpub/media/deploy/release-id.txt
User Feedback section
Configuration of the browser-side issue reporting widget.
Widget Theme
Variants:
lightdarksystem
Recommendation:
- usually
system.
Widget Language
Examples:
pl-PLen-US
Recommendation:
- in multistore, match it to the store view locale.
Auto-open after selected errors
Yes: after selected frontend errors, a feedback prompt may appearNo: the widget does not open automatically
Recommendation:
- use carefully so you are not too aggressive for the user.
Show on checkout success
Yes: the Feedback trigger may appear on the order success pageNo: no trigger in this location
Show on contact page
Yes: trigger or widget on the contact pageNo: no exposure on the contact page
Show in footer
Yes: always visible trigger in the footer or as a persistent page elementNo: no persistent trigger
This is the simplest option if you want to have a Zglos problem 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 connect the widget to your own button in the layout or CMS block.
Cron Monitoring section
This section controls check-ins and monitors for Magento crons.
Enable auto-registration of configured cron jobs
Yes: the first check-in may create or update a monitor in SentryNo: the module sends check-ins without automatic monitor configuration
Recommendation:
Yesif you have a controlled deployment and consciously defined jobs.
Monitored job codes
List of Magento job_code.
You can separate them with:
- commas,
- spaces,
- new lines.
Variants:
- empty field: monitor all crons
- list of selected
job_code: monitor only critical tasks
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 sometimes 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 the limit is exceeded, Sentry may mark the monitor as problematic.
Check-in slug prefix
Example:
magento-
Useful when one Sentry organization monitors several Magento instances and you want to avoid name 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 careful with Replay: still maintain masking and blocking
Minimal backend-only variant
Enable Backend Monitoring = YesBackend DSNcompletedEnable Frontend Monitoring = No
This is a good first step if you want to start by enabling exception and cron monitoring on the PHP side.
Most common configuration errors
- Pasting the entire
Sentryinit(...)snippet instead of only the DSN. - Having the module present in both
vendor/andapp/code/at the same time. - Different
releasevalues between events and source maps. - Overly aggressive Replay sampling in production.
- Disabling checkout and payment data masking.
- Leaving the example DSN in an active configuration.
Summary
The safest approach is to start with backend monitoring, cautious frontend monitoring, and restrictive privacy settings. Once the data in Sentry becomes stable and readable, you can gradually increase trace sampling, Replay, and the scope of business context.















