Custom Ecommerce Tracking for Tutor LMS (GA4 + Meta CAPI)

Tutor LMS provides native ecommerce functionality, but lacks built-in support for sending structured ecommerce data to analytics platforms like Google Analytics 4 (GA4) and Meta.

Role: Lead developer

The Problem

The platform relied on Tutor LMS for course sales using Stripe, but:

  • No ecommerce data was being sent to the DataLayer, making GA4 and Meta tracking incomplete
  • Key events such as view_item, add_to_cart, begin_checkout, and purchase lacked the required product-level data
  • Tutor LMS did not expose sufficient hooks or APIs to reliably access this information at the right moments
  • Existing analytics setups were limited to basic pageview tracking, with no visibility into conversion funnels or revenue attribution

Without structured ecommerce data, it was not possible to:

  • Measure conversion rates accurately
  • Optimize marketing campaigns
  • Perform reliable attribution across channels

The Solution

I built a custom plugin to generate and inject fully structured ecommerce events into the DataLayer, aligned with GA4 and Meta standards.

Event Architecture

Implemented tracking for all key ecommerce events:

  • view_item
  • add_to_cart
  • begin_checkout
  • purchase

Data Extraction Layer

  • Queried the WordPress database directly to retrieve:
    • Course ID and title
    • Pricing data
    • Product type (online, in-person, subscription)
  • Ensured data consistency across all events, regardless of entry point or purchase flow

DataLayer Integration

  • Structured events to match GA4 ecommerce schema
  • Included:
    • currency, value, and items[] arrays
    • Standardized item fields (id, name, category, price, quantity)
  • Injected events at the appropriate points in the user journey

Server-Side Tracking Compatibility

  • Designed event payloads to work seamlessly with:
    • Google Tag Manager (web container)
    • Server-side GTM for Meta Conversions API
  • Implemented consistent event_id logic to support deduplication between browser and server events

Results

  • Enabled complete ecommerce visibility across GA4 and Meta
  • Significantly improved conversion tracking accuracy and attribution
  • Allowed marketing teams to optimize campaigns based on real revenue data
  • Created a reusable tracking foundation for future features and campaigns
  • Eliminated reliance on brittle or incomplete third-party tracking workarounds