commerce_mautic_connect
1 sites
Security covered
Commerce Mautic Connect syncs Drupal Commerce cart contents and aggregated customer metrics to Mautic for advanced marketing automation. Enable abandoned cart recovery campaigns, customer
segmentation based on purchase behavior (RFM analysis), coupon usage tracking, and cross-device cart restoration via secure magic links.
Features
Abandoned Cart Recovery
- Real-Time Cart Sync: Sends HTML representation of shopping carts to Mautic the moment a user adds items - your emails show exactly what customers left behind
- Time-Based Segmentation: Tracks cart last updated timestamp, enabling sophisticated drip campaigns based on abandonment age (e.g., email after 1 hour, 24 hours, 72 hours)
- Anonymous Cart Tracking: Tracks guest visitors using Mautic's tracking cookie (
mtc_id) - syncs carts even for users who aren't logged into Drupal - Magic Links with Auto-Login: Generates secure, passwordless authentication links that restore carts across devices - automatically logs users in if the cart belongs to their account
- Cross-Device Recovery: Customers can abandon cart on desktop, click email on mobile, and their cart appears instantly with seamless auto-login
- Multilingual Support: Automatically renders cart emails and magic links in the same language as the order - product names, URLs, and recovery links all match the customer's language
preference
Coupon Tags
- Automatic Tagging: Tags Mautic contacts with coupon codes when they place orders - enables segmentation by promotions used
- Configurable Prefix: Customize tag prefix (e.g.,
coupon:,promo-,discount_) - Multiple Coupons: Supports orders with multiple coupons - each coupon creates a separate tag
- Historical Sync: Drush command to batch sync coupon tags from all existing orders
- Promotion Analysis: Create Mautic segments like "Customers who used SUMMER-20" for targeted follow-up campaigns
Customer Metrics & Segmentation
- Automatic Metric Calculation: Syncs customer metrics to Mautic on order completion, enabling RFM (Recency, Frequency, Monetary) analysis:
- Recency: Last Order Date
- Frequency: Total number of orders
- Monetary: Lifetime value (total spent)
- Tenure: First Order Date (customer age)
- AOV: Average Order Value
- Multi-Currency Support: Select a base currency for calculating metrics - automatic currency conversion with Commerce Exchanger
module - Queue-Based Processing: Uses Drupal's Queue API for background processing - RFM calculations never slow down checkout
Developer-Friendly
- Extensible Plugin Architecture: Add custom Mautic features via the
MauticFeatureplugin system - other modules can register their own settings tabs using PHP 8 attributes - Automatic Field Creation: Creates required custom fields in Mautic automatically - zero manual configuration needed
- Event-Driven Architecture: Uses Drupal's Event system for cart sync - no cron jobs required for real-time updates
- Template Preview: Built-in preview tool to test how cart emails will render before sending
- Drush Commands: Force sync for all customers or specific users via command line
Use Cases
- Cart Recovery: Send "You left something behind" emails 1 hour after cart abandonment with actual product images and one-click restoration
- VIP Segmentation (Monetary): Create VIP segments in Mautic for customers who've spent over $500
- Anniversary Campaigns (Tenure): Send "Happy Anniversary" coupons based on first purchase date
- Win-Back Campaigns (Recency): Target customers who haven't purchased in 6+ months with special offers
- Customer Lifecycle (Frequency): Trigger different email sequences based on order frequency (new vs. repeat customers)
- AOV Optimization: Segment by average order value to personalize upsell opportunities
- RFM Champions: Identify and reward customers who score high across all RFM dimensions
- Promotion Analysis (Coupon Tags): Segment customers by which coupons they've used - follow up with customers who used "SUMMER-20" with related fall promotions
Why This Module?
Unlike simple tracking pixels or analytics integrations, Commerce Mautic Connect provides:
- Bidirectional Sync: Data flows from Drupal → Mautic → back to Drupal via magic links
- Passwordless Authentication: Magic links automatically log users in, maintaining proper order history while providing frictionless cart recovery
- Rich Cart Data: Sends actual cart HTML to Mautic, not just event tracking
- Multilingual Ready: Automatically renders emails and recovery links in the customer's language
- RFM Analysis Ready: Automatically calculates and syncs metrics for advanced customer targeting
- Coupon Tracking: Tag contacts by coupon usage for promotion-based segmentation
- Anonymous Support: Works with anonymous visitors via Mautic's existing tracking cookie
- Automatic Setup: Creates all required Mautic custom fields automatically during configuration
- Extensible by Design: Plugin-based architecture allows other modules to add custom Mautic sync features (e.g., wishlist sync, birthday campaigns) without modifying core code
Requirements
- Drupal 10+
- PHP 8.1+
- Drupal Commerce (
commerce,commerce_cart,commerce_order) - Advanced Mautic Integration module (provides API connectivity to Mautic)
- A Mautic instance with API credentials (Basic Auth)
Optional Dependencies
- Commerce Exchanger - Required for automatic currency conversion in multi-currency stores
Configuration
- Ensure the Advanced Mautic Integration module is configured with valid Mautic API credentials (Basic Auth)
- Navigate to Commerce → Configuration → Mautic Connect (
/admin/commerce/config/mautic-connect) - Abandoned Cart Tab:
- Click "Create Abandoned Cart Fields in Mautic" to automatically create required fields
- Enable "Enable Abandoned Cart Sync" checkbox
- Use the Template Preview to test how cart emails will render
- Coupon Tags Tab:
- Enable "Enable Coupon Tags Sync" checkbox
- Configure Tag Prefix (default:
coupon:)
- Customer Metrics Tab:
- Select your Base Currency for metric calculations
- Click "Create Customer Metrics Fields in Mautic" to automatically create all 5 analytics fields
- Select which Order States count as completed orders
- Enable "Enable Customer Metrics Sync" checkbox
Drush Commands
drush commerce-mautic-connect:customer-metrics-sync-all(alias:cmcma) - Sync customer metrics for all customersdrush commerce-mautic-connect:customer-metrics-sync-customer [email protected](alias:cmcmc) - Sync metrics for specific customerdrush commerce-mautic-connect:abandoned-cart-sync-all(alias:cmcac) - Sync all abandoned cartsdrush commerce-mautic-connect:coupon-tags-sync(alias:cmccts) - Batch sync coupon tags from historical orders
See the full README for detailed documentation, Mautic segment examples, template customization, and how to
create custom MauticFeature plugins.