Adobe Analytics Tracking Implementation for OpenCart via GTM and Direct Code

Standard

Integrating Adobe Analytics (AA) with OpenCart can be a powerful way to unlock deep behavioral insights, including cart flow, product engagement, and conversion attribution. This guide provides two methods to implement Adobe Analytics in OpenCart:

  1. Using Google Tag Manager (GTM)
  2. Using Direct Code Injection (fallback or parallel setup)

We’ll cover tracking essentials: page views, product views, cart actions, checkout events, and purchases—along with eVars, props, and events.


🧰 Prerequisites

Requirement Purpose
OpenCart 3.x or 4.x Your eCommerce platform
Adobe Analytics Suite With Report Suite & RSID
GTM Installed For scalable tag-based deployment
Adobe Launch (optional) Tag management by Adobe


📦 Step 1: Define Data Layer in OpenCart

Design a clean dataLayer so GTM or direct scripts can use structured data.

Example – Add this to product.twig:

<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
event: 'view_item',
ecommerce: {
item_id: '{{ product_id }}',
item_name: '{{ heading_title }}',
item_category: '{{ category }}',
price: {{ price }}
},
user: {
logged_in: {{ customer_id ? 'true' : 'false' }},
customer_id: '{{ customer_id }}'
},
page: {
page_type: 'product',
page_title: '{{ heading_title }}'
}
});
</script>

Repeat similarly for:

  • Cart page: add_to_cart
  • Checkout: begin_checkout
  • Success page: purchase


📥 Step 2: Install Adobe Analytics via GTM

A. Create Adobe Analytics Tag in GTM

  1. Go to Tags > New
  2. Choose Custom HTML
  3. Insert your AppMeasurement.js (you can also host it externally)

<script src="https://assets.adobedtm.com/YOUR_APPMEASUREMENT.js"></script>
<script>
var s = s_gi("YOUR_RSID"); // Replace with Report Suite ID
s.pageName = '{{DL - page.page_title}}';
s.channel = 'OpenCart';
s.prop1 = '{{DL - page.page_type}}';
s.eVar1 = '{{DL - ecommerce.item_name}}';

if ('{{DL - event}}' === 'view_item') {
s.events = 'prodView';
}

s.t(); // Send tracking call
</script>

  1. Set Trigger: Page View or Event (e.g., view_item)

Optional: Use Adobe Launch container in GTM instead

  • Add <script src="https://assets.adobedtm.com/launch-XYZ.min.js"></script> in GTM tag
  • Use Adobe Rules inside Launch to define triggers and data mapping


🔌 Step 3: Direct Code Injection (Without GTM)

For environments without GTM, insert tracking code directly in Twig templates.

A. Product Page (product.twig)

<script src="https://assets.adobedtm.com/YOUR_APPMEASUREMENT.js"></script>
<script>
var s = s_gi("YOUR_RSID");
s.pageName = "{{ heading_title }}";
s.channel = "product";
s.eVar1 = "{{ product_id }}";
s.events = "prodView";
s.t();
</script>

B. Order Confirmation (success.twig)

<script>
var s = s_gi("YOUR_RSID");
s.pageName = "Order Confirmation";
s.purchaseID = "{{ order_id }}";
s.events = "purchase";
s.products = "{{ product_id }};{{ price }};1";
s.eVar10 = "{{ email | sha256 }}"; // Optional: hashed
s.t();
</script>


📋 Step 4: Recommended eVars, Props, and Events

Variable Description
eVar1 Product ID
eVar10 Hashed Email (optional)
prop1 Page Type
prop5 Cart Action
events prodView, scAdd, purchase

You must pre-configure these in your Adobe Admin console.


🔐 Step 5: Consent-Aware Tag Firing (GTM)

If using a Consent Management Platform (CMP), wrap Adobe firing inside a conditional block:

<script>
if (window.Cookiebot && Cookiebot.consents.given.marketing) {
var s = s_gi("YOUR_RSID");
s.pageName = 'Consent-Based Page';
s.events = 'eventX';
s.t();
}
</script>

Or configure GTM Tag Consent Settings for "ad_storage" and "analytics_storage".


🧪 Step 6: Debugging Tools

Tool Use Case
Adobe Debugger Chrome Extension See real-time beacon activity
Network Tab Look for requests to b/ss/ URLs
Adobe Experience Platform Debugger End-to-end Launch debugging


🧠 Pro Tips

  • Use product string format in s.products:
    ";productID;price;quantity;eVar;event"
  • Consider using s.linkTrackVars and s.linkTrackEvents for click tracking
  • Use s.clearVars() to prevent data leakage between pages
  • Hash PII client-side before sending (e.g., email, phone)


📈 Strategic Benefits

  • Granular visibility into product-level interactions
  • Marketing channel attribution via eVars
  • Cart abandonment and checkout funnel insight
  • Future-ready for Adobe CJA integration


Leave a Reply

Your email address will not be published. Required fields are marked *