Amplitude Analytics empowers product and growth teams to analyze user behavior at scale. Integrating Amplitude with OpenCart allows merchants to track granular e-commerce actions such as product views, cart additions, checkouts, and purchases—all with high fidelity.
🧰 Prerequisites
Requirement | Purpose |
---|---|
OpenCart (v3.x or 4.x) | E-commerce platform |
Google Tag Manager | Client-side tag deployment |
Amplitude API Key | For event tracking |
Consent Handling | Optional, for GDPR/CCPA compliance |
🎯 Goal
Track the following events in Amplitude from OpenCart:
Event Name | Trigger Location |
---|---|
Product Viewed |
Product detail page |
Add to Cart |
Add to cart button click |
Begin Checkout |
Checkout initiation |
Purchase |
Order success page |
Each event will include user ID, product data, value, and currency.
📦 Step 1: Install Amplitude JS SDK via GTM
Create a tag in your GTM Web Container:
-
Tag Type: Custom HTML
-
Trigger: All Pages
Replace YOUR_API_KEY
with your Amplitude project API key.
🛒 Step 2: Push Events via OpenCart DataLayer
Inject dynamic data from OpenCart into the dataLayer
. For example, in catalog/view/theme/*/template/checkout/success.twig
:
Repeat similar structures for:
-
Product View (product.twig)
-
Add to Cart (via JS listener on add-to-cart button)
-
Begin Checkout (checkout.twig)
🌐 Step 3: GTM Tags for Each Event
🔹 Product Viewed
Trigger: Page Path contains /product/
Tag (Custom HTML):
🔹 Add to Cart
Use a click trigger on the Add to Cart button.
🔹 Begin Checkout
Trigger: Page path contains /checkout
🔹 Purchase
Trigger: Custom Event = purchase
🔐 Consent Handling
If GDPR/CCPA applies, wrap your Amplitude tags in conditional logic:
Or, use GTM’s built-in Consent Mode to block tags until ad_storage
or analytics_storage
is granted.
🧪 Debugging
Tool | Purpose |
---|---|
GTM Preview Mode | Validate variables and triggers |
Amplitude Debug | Enable via browser dev console: localStorage.setItem('amplitude_debug', true) |
Amplitude UI | View real-time event stream |
🧠 Strategic Tips
-
Use
identify()
withuser_id
to enable cross-device journey analysis. -
Track refund events via server-side GTM and send to Amplitude’s HTTP API if needed.
-
Enable Amplitude’s cohort exports to ad platforms using the Segment or mParticle bridge.
📊 Funnel Events Summary
Event | Location | Purpose |
---|---|---|
Product Viewed | PDP Template | Engagement stage |
Add to Cart | Button Click | Intent stage |
Begin Checkout | Checkout Entry | Decision stage |
Purchase | Order Success Page | Conversion + Revenue tracking |