[Feature Request] GTM DataLayer integration — E-commerce event tracking for storefronts #14865
lucianfialho
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
The analytics module (added in #12505) provides a backend-only provider interface with
track()andidentify()methods. However:track()on commerce events (order.placed, cart.updated, etc.). The PostHog provider exists but is effectively unused without custom code.Proposal
A lightweight frontend package (
@medusajs/gtm-datalayeror similar) that:1. Injects the GTM snippet
2. Maps Medusa data to GA4 e-commerce dataLayer events
view_item_listview_itemadd_to_cartremove_from_cartview_cartbegin_checkoutadd_shipping_infoadd_payment_infopurchaserefund3. Handles Medusa-specific details
item_category/item_category2/ etc.item_variantecommerceobject before each push (required by GTM)Why GTM instead of direct GA4?
GTM is a multiplexer — the merchant configures their container once in Medusa, and from GTM they can route events to GA4, Meta Pixel, TikTok, Pinterest, Google Ads conversions, and any other tool, all without code changes. This is how it works on Shopify, WooCommerce, and every major e-commerce platform.
Scope
This could start as:
HttpTypesfor product/cart/order mappingI'm available to implement and test this.
Would love feedback on:
packages/) or as a community package?track()calls via subscribers for the existing backend analytics module?Beta Was this translation helpful? Give feedback.
All reactions