This comprehensive troubleshooting guide helps you diagnose and fix common issues with analytics tracking and performance optimization in CS-Cart.
Quick Diagnostics
Issue Categories
Choose the category that best matches your issue:
Performance Issues:
- Slow page load times
- Poor Core Web Vitals scores
- Large Cumulative Layout Shift (CLS)
- Slow Largest Contentful Paint (LCP)
Tracking Issues:
Integration Issues:
Performance Overview
Core Web Vitals
Google's Core Web Vitals measure user experience:
Largest Contentful Paint (LCP) - Loading performance
- Target: < 2.5 seconds
- LCP Troubleshooting Guide
Cumulative Layout Shift (CLS) - Visual stability
- Target: < 0.1
- CLS Troubleshooting Guide
First Input Delay (FID) / Interaction to Next Paint (INP) - Interactivity
- FID Target: < 100ms
- INP Target: < 200ms
Common CS-Cart Performance Issues
1. Slow Server Response Time
Symptoms:
- Long Time to First Byte (TTFB)
- Slow backend operations
- Database queries taking too long
Solutions:
Enable CS-Cart Caching:
- Go to Administration → Storage
- Enable File cache
- Enable Template cache
- Enable Block cache
- Configure Redis or Memcached for better performance
Optimize Database:
# SSH into server
cd /path/to/cscart
# Optimize database tables
php admin.php --dispatch=database.cleanup
Use PHP OPcache:
# php.ini configuration
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.validate_timestamps=0
2. Large JavaScript Files
Symptoms:
- Long script evaluation time
- Blocking JavaScript
- Poor Time to Interactive (TTI)
Solutions:
Defer Non-Critical Scripts:
<script src="script.js" defer></script>
Async Load Analytics:
<script async src="https://www.googletagmanager.com/gtag/js"></script>
Minify JavaScript:
- Design → Themes → [Theme] → Settings
- Enable Minimize JavaScript files
3. Unoptimized Images
Symptoms:
- Slow LCP
- High page weight
- Long download times
Solutions:
Use CS-Cart Image Optimization:
- Settings → Thumbnails
- Configure appropriate image sizes
- Enable WebP format if supported
Lazy Load Images:
<img src="image.jpg" loading="lazy" alt="Product">
Use CDN: Configure CS-Cart to serve images from CDN:
- Settings → General → CDN
- Enter CDN URL
- Configure image paths
Tracking Issues
Google Analytics Issues
GA4 Not Tracking
Check Installation:
// Browser console
console.log(typeof gtag); // Should return 'function'
console.log(window.dataLayer); // Should show array
Verify Measurement ID:
- View page source
- Search for "G-"
- Verify ID matches your GA4 property
Common Fixes:
- Clear CS-Cart cache: Administration → Storage → Clear cache
- Check for JavaScript errors in console
- Disable browser extensions (ad blockers)
- Verify tracking code is in
<head>section
No Ecommerce Data
Verify Events:
- Install GA Debugger
- Enable debug mode
- Complete test purchase
- Check console for ecommerce events
Check Event Parameters:
// Console
dataLayer.filter(obj => obj.event === 'purchase')
Common Issues:
- Missing
transaction_idparameter - Incorrect data types (string instead of number)
- Events firing before GA4 initialization
- Template not included on confirmation page
GTM Issues
GTM Container Not Loading
Diagnose:
// Browser console
console.log(typeof google_tag_manager); // Should return 'object'
Network Check:
Common Fixes:
- Verify container ID is correct (GTM-XXXXXXX)
- Check both
<head>and<body>snippets are installed - Clear CS-Cart cache
- Disable firewall/security plugins temporarily
- Check server doesn't block Google domains
Tags Not Firing
Debug in Preview Mode:
- In GTM, click Preview
- Enter your CS-Cart URL
- Check Tags Fired vs. Tags Not Fired
- Review trigger conditions
Common Issues:
- Trigger conditions not met
- Variable values incorrect
- Tag sequencing issues
- Blocking triggers active
Meta Pixel Issues
Pixel Not Detected
Use Pixel Helper:
- Install Meta Pixel Helper
- Visit your store
- Check for pixel detection
Verify Installation:
// Browser console
console.log(typeof fbq); // Should return 'function'
Common Fixes:
- Verify Pixel ID is correct
- Check pixel code is in
<head>section - Look for JavaScript errors
- Clear cache
- Test in incognito mode
Events Not Tracking
Check Events Manager:
- Go to Meta Events Manager
- Click Test Events
- Enter your URL
- Perform actions
Debug Events:
// Enable debug mode
fbq('set', 'debug', true);
// Check if event fired
console.log(fbq.queue);
Common Issues:
- Events fire before pixel initialization
- Incorrect event syntax
- Missing parameters
- Ad blockers
Duplicate Tracking
Identifying Duplicates
Check GA4:
- Reports → Realtime
- Perform action (e.g., add to cart)
- Count events in real-time view
Check GTM Preview:
- Enable Preview mode
- Perform action
- Check how many times tag fires
Common Causes
Multiple Installations
- Manual code + GTM
- Manual code + CS-Cart add-on
- Code in multiple template files
Event Listeners
- Multiple listeners on same element
- Event bubbling issues
- Not removing duplicate listeners
Template Includes
- Same template included multiple times
- Hook firing multiple times
Solutions
Search for Duplicate Code:
# SSH into server
cd design/themes/your_theme
# Search for GA4 tracking
grep -r "gtag('config'" .
# Search for GTM container
grep -r "GTM-" .
# Search for Meta Pixel
grep -r "fbq('init'" .
Remove Duplicates:
- Choose one implementation method (preferably GTM)
- Remove all other instances
- Clear cache
- Test thoroughly
Prevent Purchase Duplicates:
// Use session storage
var orderId = '12345';
if (!sessionStorage.getItem('tracked_' + orderId)) {
// Track purchase
sessionStorage.setItem('tracked_' + orderId, 'true');
}
Missing Data
Transaction Data Missing
Check Order Status:
- Tracking code on order confirmation page
- Code fires only for completed orders
- Verify order status triggers confirmation page
Verify Template Path:
design/themes/[theme]/templates/views/checkout/components/order_notification.tpl
Check Smarty Variables:
{* Debug order data *}
{if $order_info}
<!-- Order ID: {$order_info.order_id} -->
<!-- Total: {$order_info.total} -->
{else}
<!-- No order info available -->
{/if}
Product Data Missing
Verify Product Variables:
{* Debug product data *}
<!-- Product ID: {$product.product_id} -->
<!-- Product Name: {$product.product} -->
<!-- Price: {$product.price} -->
Check Template Hooks: Ensure templates are included via proper hooks:
{hook name="index:scripts"}
{* Your tracking code *}
{/hook}
Cache Issues
Clear All Caches
CS-Cart Admin:
- Administration → Storage → Clear cache
- Select All
- Click Clear
Command Line:
cd /path/to/cscart
rm -rf var/cache/*
rm -rf var/compiled/*
Browser Cache:
- Open Developer Tools (F12)
- Right-click refresh button
- Select Empty Cache and Hard Reload
Disable Cache for Testing
Temporarily disable:
// config.local.php
$config['tweaks']['disable_cache'] = true;
Remember to re-enable after testing!
AJAX Issues
AJAX Events Not Tracking
CS-Cart AJAX Endpoints:
- Add to cart:
checkout.add - Update cart:
checkout.update - Wishlist:
wishlist.add
Hook into AJAX Responses:
$(document).ajaxComplete(function(event, xhr, settings) {
if (settings.url.indexOf('checkout.add') !== -1) {
// Track event
console.log('Add to cart AJAX completed');
}
});
Debug AJAX:
// Log all AJAX calls
$(document).ajaxSend(function(event, xhr, settings) {
console.log('AJAX Request:', settings.url);
});
$(document).ajaxComplete(function(event, xhr, settings) {
console.log('AJAX Response:', xhr.responseText);
});
Browser Compatibility
Test in Multiple Browsers
- Chrome (most analytics tools optimized for Chrome)
- Firefox
- Safari (may have tracking restrictions)
- Edge
Safari Tracking Prevention
Issues:
Solutions:
- Implement server-side tracking (Conversions API, Measurement Protocol)
- Use first-party cookies
- Consider CNAME tracking for GA4
Security and Privacy
GDPR Compliance
Cookie Consent Integration:
// Wait for consent before initializing
function initTracking() {
// Initialize GA4
gtag('config', 'G-XXXXXXXXXX');
// Initialize Meta Pixel
fbq('init', 'PIXEL_ID');
}
// Check CS-Cart consent
if (Tygh.consent_accepted) {
initTracking();
}
Disable Tracking:
// GA4
window['ga-disable-G-XXXXXXXXXX'] = true;
// Meta Pixel
fbq('consent', 'revoke');
Useful Debugging Tools
Browser Extensions
- Google Analytics Debugger - GA debugging
- Meta Pixel Helper - Facebook Pixel debugging
- Tag Assistant - GTM debugging
- dataLayer Inspector - Data layer monitoring
Browser Console Commands
Check for Tracking Scripts:
// GA4
console.log(typeof gtag);
console.log(window.dataLayer);
// GTM
console.log(typeof google_tag_manager);
// Meta Pixel
console.log(typeof fbq);
Monitor Events:
// Log all dataLayer pushes
var originalPush = dataLayer.push;
dataLayer.push = function() {
console.log('DataLayer:', arguments);
return originalPush.apply(dataLayer, arguments);
};
Network Analysis
Check Tracking Requests:
- Open Developer Tools (F12)
- Network tab
- Filter by:
google-analytics.com(GA4)googletagmanager.com(GTM)facebook.com/tr(Meta Pixel)
Getting Help
CS-Cart Support
- CS-Cart Forums
- CS-Cart Documentation
- Support ticket system
Analytics Platform Support
Community Resources
- CS-Cart developers on Stack Overflow
- Analytics communities on Reddit
- Developer forums
Prevention Best Practices
1. Test Before Deploying
- Use staging environment
- Test all tracking implementations
- Verify data in debug mode
2. Document Your Setup
- List all tracking codes installed
- Document custom implementations
- Keep track of template modifications
3. Regular Monitoring
- Check analytics daily
- Review Events Manager weekly
- Monitor Core Web Vitals monthly
4. Keep Updated
- Update CS-Cart regularly
- Update tracking codes when needed
- Monitor platform changes (iOS updates, browser changes)
5. Use Version Control
- Track template changes
- Document add-on installations
- Keep rollback capability
Next Steps
Browse specific troubleshooting guides:
Or return to Integration Guides to review setup instructions.