Miva Merchant is a proprietary ecommerce platform with its own template engine (MVPS/MivaScript) and a ReadyTheme framework. Analytics issues on Miva are unique because the template engine uses a non-standard syntax, ecommerce tracking requires Miva-specific order data extraction, and the platform's built-in analytics features can conflict with third-party tracking.
Miva-Specific Debugging Approach
Miva's template system uses &mvt: and &mvte: tags for variable output. Understanding where analytics code can be safely injected requires knowledge of the page template hierarchy.
Check Template Output
# Verify analytics tags in the rendered page
curl -s "https://your-miva-store.com/" | grep -iE "gtag|gtm|analytics" | head -5
# Check for Miva's built-in Google Analytics module output
curl -s "https://your-miva-store.com/" | grep -i "google.*analytics\|ua-\|G-" | head -5
Verify via Miva Admin
- Log into Miva Admin > Menu > Modules > Scripting/Optimization
- Check for "Google Analytics" or "Google Tag Manager" modules
- Go to User Interface > Templates to inspect template code
- Check Global Header/Footer templates for tracking code placement
// In browser console, check what Miva rendered
console.log('Miva store:', document.querySelector('meta[name="generator"]')?.content);
console.log('Analytics scripts:', document.querySelectorAll('script[src*="gtag"], script[src*="gtm"]').length);
// Check for Miva's ecommerce data layer
console.log('Miva basket:', typeof Basket_Count !== 'undefined' ? Basket_Count : 'N/A');
Most Common Miva Analytics Issues
1. Built-in GA Module Conflicting with Manual GTM
Symptoms: Double pageview counts. Both Miva's GA module and your manually-added GTM container fire analytics.
Root cause: Miva's built-in "Google Analytics" module (found in Modules > Scripting/Optimization) auto-injects GA tracking. Adding GTM separately creates duplicate tracking.
Fix: Use one method, not both:
# Option A: Disable the built-in module
# Miva Admin > Modules > find "Google Analytics" > Uninstall or disable
# Option B: Use only the built-in module
# Configure it with your GA4 Measurement ID and remove manual code
2. MVPS Template Tags Breaking JavaScript
Symptoms: JavaScript syntax errors in the console. Analytics code has &mvt: or &mvte: fragments rendered as literal text or causing parse errors.
Root cause: Miva's template engine processes all content for MVPS tags. If your JavaScript happens to contain sequences that look like Miva tags, the engine will attempt to parse them.
Fix: Place analytics code in a way that avoids MVPS parsing conflicts:
<!-- In Miva Admin > User Interface > Global Header Template -->
<!-- Use external script file to avoid MVPS parsing entirely -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script src="/mm5/themes/yourtheme/js/analytics-init.js"></script>
For the external file (uploaded via User Interface > CSS/JS Resources):
// analytics-init.js — no MVPS parsing issues
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');
3. Order Confirmation Tracking Not Firing
Symptoms: Pageviews track correctly but ecommerce purchase events are missing or have incorrect revenue data.
Root cause: Miva's order confirmation page (OCST/OSEL) uses specific MVPS variables for order data. If your dataLayer push does not correctly reference these Miva variables, the purchase event fails.
Fix: Use Miva's MVPS variables on the order confirmation template:
<!-- In the OCST (Order Confirmation) page template -->
<script>
dataLayer.push({
'event': 'purchase',
'ecommerce': {
'transaction_id': '&mvte:order:id;',
'value': &mvt:order:total;,
'currency': 'USD',
'items': [
<!-- Miva requires a loop for order items -->
<mvt:foreach iterator="item" array="order:items">
{
'item_id': '&mvte:item:code;',
'item_name': '&mvte:item:name;',
'price': &mvt:item:price;,
'quantity': &mvt:item:quantity;
},
</mvt:foreach>
]
}
});
</script>
4. ReadyTheme AJAX Cart Updates Not Tracked
Symptoms: Add-to-cart events do not fire. The cart uses AJAX updates that bypass page loads.
Root cause: Miva's ReadyTheme framework uses AJAX for cart operations (add, update, remove). These AJAX calls do not trigger page-level analytics events.
Fix: Hook into Miva's ReadyTheme AJAX events:
// Listen for Miva ReadyTheme cart events
document.addEventListener('ReadyTheme_Basket_Updated', function(e) {
gtag('event', 'add_to_cart', {
currency: 'USD',
items: [{
item_id: e.detail?.product_code || '',
item_name: e.detail?.product_name || '',
quantity: e.detail?.quantity || 1
}]
});
});
5. Miva URL Structure Fragmenting Analytics Data
Symptoms: The same page appears with multiple URL paths in GA. Product pages show different URLs for the same product.
Root cause: Miva's URL structure can include screen codes, session IDs, and category paths. The same product may be accessible via /product-slug, /category/product-slug, and /mm5/merchant.mvc?Screen=PROD&Product_Code=XXX.
Fix: Normalize page paths in your analytics configuration:
// Strip Miva session IDs and normalize paths
var cleanPath = window.location.pathname
.replace(/\/mm5\/merchant\.mvc.*/, function(match) {
var screen = new URLSearchParams(match.split('?')[1]).get('Screen');
return '/' + (screen || 'home').toLowerCase();
});
gtag('config', 'G-XXXXXXX', { page_path: cleanPath });
Environment Considerations
- Miva-hosted vs self-hosted: Miva offers both SaaS and self-hosted deployments. SaaS customers cannot access server logs or modify
.htaccessfiles - MivaScript engine: Miva's proprietary scripting language is processed server-side. All MVPS tags render before the page reaches the browser
- ReadyTheme vs custom themes: ReadyTheme provides pre-built AJAX functionality. Custom themes may not include these event hooks
- PCI compliance: Miva's checkout pages have strict requirements. Custom JavaScript on checkout/payment pages may be restricted by PCI policies
- Module system: Analytics modules in Miva are installed via the admin panel. Check Modules > Scripting/Optimization for any active analytics modules
Performance Issues
- LCP Issues - MivaScript rendering overhead and product image loading
- CLS Issues - Layout shifts from AJAX cart updates and ReadyTheme dynamic content
Tracking Issues
- Events Not Firing - Debug built-in module conflicts, MVPS template parsing, and AJAX cart tracking gaps
Related Resources
- Miva documentation
- Global Issues Hub for platform-agnostic solutions