Setting Up Google Ads Enhanced Conversions in OpenCart (with Code & GTM)

Standard

Enhanced Conversions in Google Ads enable more accurate conversion tracking by securely sending first-party customer data—like email, phone number, or name—from your OpenCart store to Google. This improves attribution, particularly for logged-in users, even if cookies are restricted.

✅ What Are Enhanced Conversions?

Feature Benefit
Uses hashed first-party data Improves match rate & ROAS accuracy
Works with consent Privacy-compliant with consent mode
Improves attribution More complete conversion path in Ads
Supports offline conversion imports Optional advanced use case


🧰 Requirements

  • GTM web container installed in OpenCart
  • Google Ads conversion action already created
  • Access to OpenCart checkout success page
  • Customer data available on success page (email, phone, name)
  • Consent mode implemented (recommended)


🚀 Step-by-Step: Setting Up Enhanced Conversions in OpenCart via GTM


🔹 Step 1: Create or Identify Your Google Ads Conversion Action

In your Google Ads account:

  1. Go to Tools & Settings > Conversions
  2. Select your existing Purchase conversion action, or create a new one
  3. Under “Enhanced conversions”, enable enhanced conversions and select Google Tag Manager
  4. You’ll see instructions and confirmation of Enhanced Conversions being active

✅ No new Conversion ID/Label is needed.


🔹 Step 2: Output Customer Data to dataLayer on Thank You Page

In OpenCart, modify:

File: catalog/controller/checkout/success.php

$order_id = $this->session->data['order_id'];
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);

$data['gtm_enhanced_conversion'] = json_encode([
'event' => 'purchase',
'email' => $order_info['email'],
'phone' => preg_replace('/\D/', '', $order_info['telephone']), // digits only
'first_name' => $order_info['firstname'],
'last_name' => $order_info['lastname'],
'country' => $order_info['payment_iso_code_2'],
'postal_code' => $order_info['payment_postcode']
]);

File: success.twig (in catalog/view/theme/YOUR_THEME/template/checkout/)

{% if gtm_enhanced_conversion %}
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({{ gtm_enhanced_conversion|raw }});
</script>
{% endif %}

✅ This exposes user data only on the purchase confirmation page.


🔹 Step 3: Create GTM Data Layer Variables

In GTM:

Variable Name Type Data Layer Variable
DLV - email Data Layer Variable email
DLV - phone Data Layer Variable phone
DLV - first_name Data Layer Variable first_name
DLV - last_name Data Layer Variable last_name
DLV - country Data Layer Variable country
DLV - postal_code Data Layer Variable postal_code


🔹 Step 4: Configure Google Ads Conversion Tag for Enhanced Conversions

In GTM:

  1. Go to Tags > New
  2. Tag Type: Google Ads Conversion Tracking
  3. Use:
    • Conversion ID: e.g. AW-123456789
    • Conversion Label: e.g. XyZAbc1234
  4. Enable Conversion Value Tracking if applicable
  5. Scroll down and enable Enhanced Conversions
  6. Choose: Use data layer
  7. Confirm GTM detects:
    • email
    • phone
    • first_name
    • last_name
    • country
    • postal_code
  8. Trigger: Use Custom Event trigger → purchase

✅ This ensures that hashed personal data is sent securely to Google Ads when a purchase happens.


🔹 Step 5: Add Consent Mode (Optional but Recommended)

If you’re using a Consent Management Platform (CMP) or cookie banner, configure Consent Mode v2 in GTM before any tag fires.

<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag("consent", "default", {
ad_storage: "denied",
analytics_storage: "denied"
});
</script>

On consent accept:

gtag("consent", "update", {
ad_storage: "granted",
analytics_storage: "granted"
});

✅ This keeps your implementation privacy-compliant under GDPR/CCPA.


🔹 Step 6: Test Your Setup

  1. Open GTM Preview Mode
  2. Complete a test order on your OpenCart store
  3. Confirm:
    • purchase event fires
    • Email, phone, and name values appear in the dataLayer
    • Google Ads Conversion Tag fires
  4. In Google Ads → Conversions, check for Enhanced Conversion data within 24–48 hours
  5. You can also use Chrome Tag Assistant to confirm Enhanced Conversions are active


🧠 Best Practices

Practice Why
Hashing handled by Google No need to manually hash in GTM
Send only on Thank You Page Ensures customer data is not exposed early
Use consent signals To meet legal data processing standards
Avoid hardcoding customer data Always pull from the order object dynamically
Use Timer triggers for backups Ensure tag doesn’t miss on fast redirects


🧪 Troubleshooting Tips

Issue Fix
Tag not firing Ensure purchase event exists in dataLayer
Missing email Check PHP logic in success.php
Tag fires before user data available Use timer or DOM-ready trigger
Consent not granted Check CMP logic or console warnings


📦 Summary

Step Action
1 Enable Enhanced Conversions in Google Ads
2 Push customer data to dataLayer on order confirmation
3 Create GTM Data Layer Variables
4 Configure Google Ads Tag for Enhanced Conversions
5 Add Consent Mode to stay compliant
6 QA using GTM Preview & Tag Assistant
7 Monitor in Google Ads → Conversions dashboard


Leave a Reply

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