๐Ÿ“Š State of Magento 2025 โ†’

The Home for Magento 2 Excellence

Quality-tested Magento 2 modules. Explore. Evaluate. Elevate. #magento2

616 Modules
403 Ready
212 Need Help
๐Ÿ† Leaderboard
Popular Module Actively Maintained v4.8.9

Clerk for Magento 2

clerk/magento2

Integrates Clerk.io with Magento 2. Enables personalized search, recommendations, and email marketing.

244,269
Downloads
Above average
9
GitHub Stars
Below average
11d ago
Last Release
27
Open Issues
Build Passing
Ready to install

Build Tests

Composer Install
DI Compile
Templates

Code Quality

CS Coding Standard
84 errors , 1186 warnings
PHPStan Failed

Tested on Magento 2.4.8-p3

Recent Test History

Each release is tested against the latest Magento version at that time.

v4.8.9 on Magento 2.4.8-p3
Feb 5, 2026
v4.8.8 on Magento 2.4.8-p3
Dec 30, 2025

Share This Module's Status

Clerk for Magento 2 Magento compatibility status badge

README

Loaded from GitHub

Clerk.io for Magento 2

The official Clerk.io extension for Magento 2. It connects your store to Clerk.io's AI platform, giving you personalized search, product recommendations, and visitor tracking out of the box.

Version: 4.8.9 ยท PHP: 7.4+ ยท Magento: 2.3+


What It Does

This extension handles three things:

  1. Feeds your product data to Clerk.io โ€” Exposes REST-style endpoints (/clerk/product, /clerk/order, /clerk/category, etc.) that the Clerk.io platform calls to sync your catalog. Also pushes real-time updates when products are saved or deleted.

  2. Renders Clerk.io on the frontend โ€” Injects Clerk.js on every page, which handles search results, live search dropdowns, recommendation sliders, exit-intent popups, and tracking.

  3. Tracks visitor behavior โ€” Logs page views, clicks, cart contents, and completed orders so Clerk.io's AI can learn and improve results.

Feature Overview

| Feature | What it does | |---------|-------------| | Search | Replaces Magento's native search results page with Clerk.io's. Supports faceted filtering. | | Live Search | Type-ahead dropdown on the search field. Configurable selector, categories, suggestions count. | | Recommendations | Sliders on product, category, cart, and home pages ("also bought", "alternatives", "trending", etc.) | | Powerstep | After add-to-cart, shows a page or popup with "keep shopping" recommendations. Works by overriding Magento\Checkout\Controller\Cart\Add via a DI preference. | | Exit Intent | Overlay triggered when the visitor moves to leave the page. | | Sales Tracking | <span> on the checkout success page that logs the order to Clerk.io. | | Basket Tracking | Intercepts Magento's cart AJAX calls via a patched XMLHttpRequest to keep Clerk.io in sync with the cart. | | Real-Time Sync | Observers on catalog_product_save_after and catalog_product_delete_after_done push changes to the Clerk.io API instantly. Also tracks order returns via credit memo observer. |


Installation

Composer (recommended):

composer require clerk/magento2
bin/magento module:enable Clerk_Clerk
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

After install, go to Stores > Configuration > Clerk > Configuration and enter your API keys from my.clerk.io.

Full setup guide: help.clerk.io/integrations/magento-2/get-started


How It Works Under the Hood

Data Feed Endpoints

All under the clerk/ frontend route. Authentication legacy public/private key. Auth logic is in Controller/AbstractAction.php.

| Endpoint | What it returns | |----------|----------------| | /clerk/product | Products with prices (incl/excl tax), stock, images, categories, child product data, tier prices, visibility | | /clerk/order | Orders with line items, quantities, email, customer ID | | /clerk/category | Categories with parent/child relationships and URLs | | /clerk/customer | Customers with configurable attributes (if enabled) | | /clerk/page | CMS pages | | /clerk/version | Magento version, extension version, PHP version |

All paginated endpoints accept page, limit, orderby, order, fields parameters.

There are also diagnostic endpoints (/clerk/getconfig, /clerk/setconfig, /clerk/rotatekey.


Structure

โ”œโ”€โ”€ Controller/
โ”‚   โ”œโ”€โ”€ AbstractAction.php          โ† Base class: auth, pagination, scope resolution
โ”‚   โ”œโ”€โ”€ Product/Index.php           โ† Product data feed
โ”‚   โ”œโ”€โ”€ Order/Index.php             โ† Order data feed
โ”‚   โ”œโ”€โ”€ Category/Index.php          โ† Category data feed
โ”‚   โ”œโ”€โ”€ Customer/Index.php          โ† Customer data feed
โ”‚   โ”œโ”€โ”€ Page/Index.php              โ† CMS page data feed
โ”‚   โ”œโ”€โ”€ Checkout/Cart/Add.php       โ† Overrides native add-to-cart (powerstep)
โ”‚   โ”œโ”€โ”€ Cart/Added.php              โ† Powerstep page controller
โ”‚   โ”œโ”€โ”€ Powerstep/Popup.php         โ† Powerstep popup AJAX
โ”‚   โ””โ”€โ”€ Adminhtml/Dashboard/        โ† Admin dashboard iframe controllers
โ”‚
โ”œโ”€โ”€ Model/
โ”‚   โ”œโ”€โ”€ Config.php                  โ† All config path constants
โ”‚   โ”œโ”€โ”€ Api.php                     โ† Curl-based Clerk.io API client
โ”‚   โ””โ”€โ”€ Adapter/Product.php         โ† Builds the product data payload (prices, stock, images, children)
โ”‚
โ”œโ”€โ”€ Observer/
โ”‚   โ”œโ”€โ”€ ProductSaveAfterObserver.php          โ† Real-time sync on product save
โ”‚   โ”œโ”€โ”€ ProductDeleteAfterDoneObserver.php    โ† Real-time removal on product delete
โ”‚   โ”œโ”€โ”€ SalesOrderCreditmemoSaveAfterObserver โ† Track returned orders
โ”‚   โ”œโ”€โ”€ CheckoutCartAddProductCompleteObserver โ† Trigger powerstep popup
โ”‚   โ”œโ”€โ”€ CheckoutCartUpdateItemsAfterObserver  โ† Basket tracking to Clerk API
โ”‚   โ””โ”€โ”€ LayoutLoadBeforeObserver.php          โ† Inject Clerk search layout handle
โ”‚
โ”œโ”€โ”€ Block/
โ”‚   โ”œโ”€โ”€ Tracking.php                โ† Clerk.js init block
โ”‚   โ”œโ”€โ”€ LiveSearch.php              โ† Live search config block
โ”‚   โ”œโ”€โ”€ Result.php                  โ† Search results page block
โ”‚   โ”œโ”€โ”€ SalesTracking.php           โ† Order tracking block
โ”‚   โ”œโ”€โ”€ Powerstep.php               โ† Powerstep page block
โ”‚   โ”œโ”€โ”€ PowerstepPopup.php          โ† Powerstep popup block
โ”‚   โ”œโ”€โ”€ ExitIntent.php              โ† Exit intent block
โ”‚   โ””โ”€โ”€ Widget/Content.php          โ† Recommendations widget (product/category/cart)
โ”‚
โ”œโ”€โ”€ etc/
โ”‚   โ”œโ”€โ”€ module.xml                  โ† Module declaration (depends on Magento_CatalogSearch)
โ”‚   โ”œโ”€โ”€ di.xml                      โ† DI preference overriding Cart\Add controller
โ”‚   โ”œโ”€โ”€ events.xml                  โ† Global observers (product save/delete)
โ”‚   โ”œโ”€โ”€ config.xml                  โ† Default config values
โ”‚   โ”œโ”€โ”€ widget.xml                  โ† Clerk content widget definition
โ”‚   โ”œโ”€โ”€ csp_whitelist.xml           โ† CSP rules for api/cdn/custom.clerk.io
โ”‚   โ”œโ”€โ”€ adminhtml/system.xml        โ† Admin config fields (this is where all settings live)
โ”‚   โ””โ”€โ”€ frontend/
โ”‚       โ”œโ”€โ”€ routes.xml              โ† Frontend routes: clerk/*, checkout/*
โ”‚       โ””โ”€โ”€ events.xml              โ† Frontend observers (layout, cart, powerstep)
โ”‚
โ”œโ”€โ”€ view/frontend/
โ”‚   โ”œโ”€โ”€ layout/
โ”‚   โ”‚   โ”œโ”€โ”€ default.xml             โ† Adds tracking, live search, exit intent to every page
โ”‚   โ”‚   โ”œโ”€โ”€ clerk_result_index.xml  โ† Replaces native search with Clerk search
โ”‚   โ”‚   โ”œโ”€โ”€ catalog_product_view.xml โ† Product page recommendations
โ”‚   โ”‚   โ”œโ”€โ”€ catalog_category_view.xml โ† Category page recommendations
โ”‚   โ”‚   โ”œโ”€โ”€ checkout_cart_index.xml  โ† Cart page recommendations
โ”‚   โ”‚   โ””โ”€โ”€ checkout_onepage_success.xml โ† Sales tracking
โ”‚   โ””โ”€โ”€ templates/
โ”‚       โ”œโ”€โ”€ tracking.phtml          โ† Clerk.js loader + config + basket tracking
โ”‚       โ”œโ”€โ”€ livesearch.phtml        โ† Live search span
โ”‚       โ”œโ”€โ”€ result.phtml            โ† Search results page
โ”‚       โ”œโ”€โ”€ sales_tracking.phtml    โ† Order tracking span
โ”‚       โ””โ”€โ”€ widget.phtml            โ† Recommendation slider span
โ”‚
โ”œโ”€โ”€ Helper/Image.php                โ† Product image URL builder
โ”œโ”€โ”€ i18n/                           โ† Translations (en_US, da_DK, es_ES, it_IT)
โ”œโ”€โ”€ registration.php                โ† Module registration
โ””โ”€โ”€ composer.json                   โ† Package: clerk/magento2

Customizing & Extending

If you need to customize the extension, here are the parts to be careful with.

tracking.phtml โ€” be very careful. This template loads Clerk.js and configures the entire integration. It also intercepts Magento's cart AJAX calls to keep basket tracking in sync with Clerk.io. If you override this template, make sure you keep the Clerk.js initialization and the Clerk('config', {...}) call intact, or nothing will work. You can disable basket tracking in admin under Synchronization > Collect Baskets.

etc/di.xml โ€” the add-to-cart override. The extension replaces Magento's Magento\Checkout\Controller\Cart\Add controller entirely with its own version (Clerk\Clerk\Controller\Checkout\Cart\Add) to make the powerstep work. This means:

  • If another extension also tries to override Cart\Add via a DI preference, one of them will win and the other will break. Magento only allows one preference per class.
  • If you need to modify add-to-cart behavior, create a plugin on Clerk\Clerk\Controller\Checkout\Cart\Add โ€” not on the original Magento class.
  • If the powerstep is causing conflicts and you don't need it, you can disable it in admin, but the DI preference is still active.

Controller/AbstractAction.php โ€” the authentication layer. All data feed endpoints (/clerk/product, /clerk/order, etc.) go through this base controller which handles JWT token validation and API key authentication. Don't plugin around the dispatch() method unless you fully understand the auth flow โ€” you could accidentally expose your product feed publicly or break the sync.

The Clerk.js <span> data attributes. The search results, live search, and recommendation blocks work by outputting <span class="clerk" data-template="@..." data-products="[...]"> tags. Clerk.js finds these spans and replaces them with rendered content. If you change the data-* attribute names or the class="clerk" marker, Clerk.js won't find them and nothing will render.


Troubleshooting

  • Extension not showing up: Run bin/magento module:status Clerk_Clerk. If disabled, run bin/magento module:enable Clerk_Clerk && bin/magento setup:upgrade.
  • Search not working: Check API keys in admin config. Open browser console and look for Clerk.js errors. Verify clerk/search/enabled is "Yes".
  • Products missing from feed: Visit /clerk/product?limit=1 (with auth) to check the feed. Verify product visibility settings in the Clerk config match what you expect.
  • Real-time sync not working: Check clerk/product_synchronization/use_realtime_updates is enabled. Check var/log/clerk_log.log for errors.
  • Powerstep conflicting with another extension: Both may be overriding Magento\Checkout\Controller\Cart\Add. You'll need to resolve the DI preference conflict.

Enable logging at Stores > Configuration > Clerk > Logging โ€” set level to "All" and destination to "File" to write to var/log/clerk_log.log.


Links


Contributing

  1. Fork and branch from master
  2. Test against a Magento 2 instance
  3. Open a PR with a clear description

Issues & feature requests: github.com/clerkio/clerk-magento2/issues


Support

This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.