Skip to content

Repository files navigation

WHMCS Google Analytics Enhanced E-commerce Module

Overview

This WHMCS addon module integrates Google Analytics Enhanced E-commerce tracking with your WHMCS installation. It provides comprehensive tracking of customer behavior, transactions, product performance, and sales analytics.

Features

Main Features

  • Transaction Tracking: Track completed orders and payments
  • Product Analytics: Monitor product impressions, add to cart, and remove from cart actions
  • Checkout Funnel Analysis: Track customer journey through the checkout process
  • User Behavior Tracking: Monitor shopping behavior and user interactions
  • Domain Purchase Tracking: Special tracking for domain registrations and renewals
  • Multi-currency Support: Handle transactions in multiple currencies
  • Marketing Analytics: Track coupon usage and promotional campaigns

Supported Analytics

  • Shopping Behavior Analysis: See how users navigate your product catalog
  • Checkout Behavior Analysis: Monitor checkout completion rates and abandonment
  • Product Performance: Analyze which products perform best
  • Sales Performance: Track revenue, transaction values, and tax information
  • Order Coupons: Monitor coupon effectiveness
  • Domain Analytics: Track domain purchases by TLD

Installation

  1. Upload the module files to your WHMCS installation:

    /modules/addons/ga_enhanced_ecommerce/
    
  2. Login to your WHMCS Admin Area

  3. Go to Setup > Addon Modules

  4. Find "Google Analytics Enhanced E-commerce" and click Activate

  5. Click Configure to set up your tracking

Configuration

Required Settings

  • Google Analytics Tracking ID: Your GA tracking ID (UA-XXXXXXXX-X or G-XXXXXXXXXX)

Optional Settings

  • Google Tag Manager Container ID: If using GTM instead of direct GA
  • Default Currency: Base currency for analytics (defaults to USD)

Tracking Options

  • Enable Enhanced E-commerce: Master toggle for all tracking
  • Track User ID: Associate actions with logged-in users
  • Track Transactions: Monitor completed orders and payments
  • Track Cart Actions: Monitor add/remove cart actions
  • Track Checkout Funnel: Monitor checkout process steps
  • Track Product Impressions: Monitor product page views
  • Track Domain Purchases: Special tracking for domains
  • Debug Mode: Enable console logging for troubleshooting

Google Analytics Setup

1. Enable Enhanced E-commerce in Google Analytics

  1. Go to your Google Analytics property
  2. Navigate to Admin > E-commerce Settings
  3. Enable E-commerce and Enhanced E-commerce Reporting
  4. Set up your checkout funnel steps if desired

2. Configure Goals (Optional)

Set up conversion goals in Google Analytics:

  • Purchase completion
  • Newsletter signup
  • Account registration

3. View Reports

Enhanced e-commerce data appears in:

  • Conversions > E-commerce > Overview
  • Conversions > E-commerce > Product Performance
  • Conversions > E-commerce > Shopping Behavior
  • Conversions > E-commerce > Checkout Behavior

Tracked Events

Automatic Events

  • page_view: Standard page view tracking
  • purchase: When an order is completed
  • add_to_cart: When products are added to cart
  • remove_from_cart: When products are removed from cart
  • begin_checkout: When checkout process starts
  • view_item: When product details are viewed
  • view_item_list: When product lists are displayed

Custom Events

  • domain_register: Domain registration tracking
  • domain_renewal: Domain renewal tracking
  • coupon_usage: Coupon application tracking

Data Structure

Transaction Data

{
  transaction_id: "order_123",
  value: 99.99,
  currency: "USD",
  tax: 8.99,
  shipping: 5.00,
  items: [...]
}

Product Data

{
  item_id: "product_456",
  item_name: "Web Hosting Basic",
  item_category: "Hosting",
  quantity: 1,
  price: 99.99
}

Technical Implementation

Hook Integration

The module uses WHMCS hooks to automatically track:

  • Order completion (InvoicePaid, OrderPaid)
  • Domain registration (DomainRegister)
  • Domain renewal (DomainRenewal)
  • Shopping cart changes (ShoppingCartCheckout)
  • User login (ClientLogin)

Client-side Tracking

JavaScript integration handles:

  • Real-time cart interactions
  • Product impression tracking
  • Checkout funnel progression
  • Custom event tracking

Troubleshooting

Common Issues

1. No data in Google Analytics

  • Verify your tracking ID is correct
  • Check that Enhanced E-commerce is enabled in GA
  • Enable debug mode to see console logs
  • Allow 24-48 hours for data to appear

2. Missing transaction data

  • Ensure "Track Transactions" is enabled
  • Check that orders are completing successfully
  • Verify the invoice/order completion hooks are firing

3. Cart tracking not working

  • Ensure "Track Cart Actions" is enabled
  • Check that cart buttons have proper data attributes
  • Verify JavaScript is loading correctly

Debug Mode

Enable debug mode in the module configuration to:

  • Log all tracking events to browser console
  • Verify data being sent to Google Analytics
  • Troubleshoot integration issues

Data Attributes

For proper tracking, ensure your template includes:

<div data-product-id="123" 
     data-product-name="Web Hosting" 
     data-product-category="Hosting"
     data-product-price="99.99"
     data-product-currency="USD">
  <button class="btn-add-to-cart">Add to Cart</button>
</div>

Privacy Considerations

GDPR Compliance

  • User ID tracking is optional and should be used with proper consent
  • Consider implementing consent management
  • Review Google Analytics data retention settings

Data Collection

The module collects:

  • Transaction information (amounts, product names)
  • User behavior data (page views, clicks)
  • Optional user IDs (when enabled and consented)

Support

Module Information

  • Version: 1.0.0
  • Compatibility: WHMCS 7.0+
  • License: MIT

Documentation

Version History

v1.0.0 (Initial Release)

  • Complete Enhanced E-commerce integration
  • Multi-currency support
  • Domain purchase tracking
  • Checkout funnel analysis
  • Shopping behavior tracking
  • Product performance analytics
  • Marketing promotion tracking

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages