Server-Side CAPI & Event Tracking
Bypass adblockers and ITP restrictions by routing MousePlayer traffic through your own First-Party Server-Side GTM container, and track deep E-commerce analytics.
1. Tracking Modes Overview
MousePlayer V2 introduces a powerful Event Router that allows you to control how data flows from your user's browser to our servers. You can choose from three distinct modes:
- Web Only (Default): Streams all data via WebSockets directly to MousePlayer. Best for real-time Live View, but vulnerable to heavy adblockers.
- Hybrid Mode: The best of both worlds. Sends lightweight mouse/scroll coordinates via WebSockets for smooth Live View, while heavy DOM mutations and Custom Events are batched and routed securely through your Server-Side GTM via HTTP POST.
- Pure CAPI: 100% HTTP POST batching. Maximum privacy, zero WebSockets, fully first-party. Note: Live View is disabled in this mode.
2. Google Tag Manager Setup (Recommended)
The easiest way to implement Hybrid or Pure CAPI modes is by utilizing our official GTM Community Templates. Download the .tpl files below and import them into your GTM workspaces.
Step 1: Configure the Server-Side Client & Tag
In your Server-Side GTM container, import the Ingest Client template. Set it to listen on a custom path (e.g., /mp_capi). Then, import the Connector Tag, configure it to fire on the mouseplayer_batch event, and deploy your container.
Step 2: Configure the Web GTM Tag
In your Web GTM container, import the SDK Tag. Select "Configuration & Initialization" as the Tag Type, input your Channel ID, select Hybrid Mode, and paste your ssGTM Endpoint URL (e.g., https://metrics.yourdomain.com/mp_capi).
3. Manual Installation (Without GTM)
If you prefer hardcoding the script, you must define the window.mp_config object before loading the tracking snippet.
4. E-Commerce Funnel Tracking
Track the complete customer journey. Using standardized event names allows MousePlayer to automatically generate beautiful E-Commerce Funnel reports in your project workspace. All events are fully compatible with CAPI and Web-Only modes.
1. view_item
Trigger this event when a user views a specific product page.
2. add_to_cart
Trigger this event when a user adds an item to their shopping cart.
3. begin_checkout
Trigger this event when a user proceeds to the checkout screen.
4. purchase
Trigger this event upon successful payment or order confirmation.
5. Custom Events & Lead Generation
You are not limited to e-commerce. Track form submissions, newsletter signups, or custom interactions unique to your web application.
Lead Generation (Form Submit)
Fire this event when a user successfully submits a contact form or requests a quote.
Custom UI Interaction
Understand how users interact with complex elements like calculators, modals, or tab switches.
6. Parameter Limits & Guidelines
Data Typing: MousePlayer automatically detects parameter types. Send numbers as integers or floats (e.g., 150.00, not "150.00") to enable advanced numerical filtering (e.g., "Price > 100") in the dashboard.
| Rule | Description |
|---|---|
| Event Name Length | Maximum 128 characters. Use snake_case for best readability (e.g., user_signup). |
| Parameter Key Length | Maximum 64 characters per key name (e.g., transaction_id). |
| String Values | Text parameters are truncated to 255 characters to ensure optimal database performance. |
| Data Privacy | Do not send Personally Identifiable Information (PII) such as raw email addresses, real names, or passwords as event parameters. |