πŸ›’ Matching OpenCart Product Feeds with Google Ads Dynamic Remarketing Events

Standard

For effective Google Ads Dynamic Remarketing, you need to ensure that the product IDs in your OpenCart events match the product IDs in your Google Merchant Center (GMC) feed. Without a perfect match, your ads won’t show the right products or may not appear at all.

βœ… Why Matching Product IDs Matters

Element Must Match
GA4/GTM ecomm_prodid Merchant feed id
Price in GTM Feed product price (optional but recommended)
Category (optional) Helps with audience segmentation


🧰 Requirements

  • OpenCart store (v3.x or v4.x)
  • Google Merchant Center account and approved product feed
  • Google Ads linked to Merchant Center
  • GTM container installed on your site
  • Feed uses Product ID (SKU or model) as id field


πŸš€ Step-by-Step: Match OpenCart Product Data to Merchant Center IDs


πŸ”Ή Step 1: Decide Your Feed Identifier Strategy

Check your Google Merchant Center product feed:

  • Is the product ID the SKU?
  • Or the model number?
  • Or the OpenCart product ID?

Most feeds are set up with the model number or SKU.

πŸ‘‰ You’ll need to send the same value in the ecomm_prodid for GTM dynamic remarketing.


πŸ”Ή Step 2: Modify product.php Controller to Include Correct Product ID

Edit: catalog/controller/product/product.php

$product_id = (int)$this->request->get['product_id'];
$product_info = $this->model_catalog_product->getProduct($product_id);

$data['gtm_view_item'] = json_encode([
'event' => 'view_item',
'ecommerce' => [
'items' => [[
'id' => $product_info['model'], // Use model to match GMC feed
'name' => $product_info['name'],
'category' => 'Replace with category if available',
'price' => $product_info['price']
]]
]
]);

πŸ‘‰ Replace 'model' with 'sku' if that’s what your Merchant feed uses.

βœ… This ensures the same ID is used in both feed and event.


πŸ”Ή Step 3: Output the DataLayer Script in the Product Page

In product.twig:

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

βœ… This outputs the view_item event in a GA4/eCommerce-ready format.


πŸ”Ή Step 4: Add the Same Product ID to Cart Events

In catalog/controller/checkout/cart.php or via AJAX response:

$data['gtm_add_to_cart'] = json_encode([
'event' => 'add_to_cart',
'ecommerce' => [
'items' => [[
'id' => $product_info['model'], // Same match as above
'name' => $product_info['name'],
'price' => $product_info['price'],
'quantity' => $quantity
]]
]
]);


πŸ”Ή Step 5: Create GTM Variables for ID Matching

In GTM:

  1. DLV – item_id β†’ ecommerce.items.0.id
  2. DLV – item_name β†’ ecommerce.items.0.name
  3. DLV – item_price β†’ ecommerce.items.0.price

βœ… Use these for dynamic remarketing and GA4 event tagging.


πŸ”Ή Step 6: Setup Google Ads Remarketing Tag in GTM

  1. Tag Type: Google Ads Remarketing
  2. Conversion ID: From your Google Ads account
  3. Custom Parameters:

ecomm_prodid: {{DLV - item_id}},
ecomm_pagetype: 'product',
ecomm_totalvalue: {{DLV - item_price}}

  1. Trigger: Custom Event: view_item

πŸ‘‰ Use different ecomm_pagetype values for cart, category, checkout, etc.


πŸ”Ή Step 7: Validate Product Feed in Merchant Center

  1. Go to Google Merchant Center β†’ Products β†’ Feeds
  2. Download your product feed
  3. Confirm the id column matches the values you’re pushing as ecomm_prodid in GTM
  4. Ensure no mismatch or null values exist

βœ… If you’re using GTIN or SKU as ID in the feed, use the same value in OpenCart events.


πŸ”Ή Step 8: Test with Google Tag Assistant + GA4 DebugView

  1. Open your product page
  2. In Tag Assistant:
    • Look for view_item event
    • Confirm ecomm_prodid matches your Merchant feed
  3. In GA4 DebugView:
    • Confirm item_id equals Merchant Center product ID


πŸ”„ Bonus: Output Category for Dynamic Audiences

You can add category dynamically too:

$categories = $this->model_catalog_product->getCategories($product_id);
$category_id = $categories[0]['category_id'];
$category_info = $this->model_catalog_category->getCategory($category_id);

$category_name = $category_info['name'];

And then:

'category' => $category_name

βœ… You can later segment audiences in Google Ads based on category pageviews.


🧠 Best Practices

Practice Tip
Feed ID must match OpenCart ID exactly Including case-sensitivity and format
Test real product examples Validate with Tag Assistant and live feed
Always sanitize null or invalid IDs Prevents tracking errors
Update IDs if feed structure changes Keep events and feed aligned
Add default fallback values For products missing SKU or model


πŸ“¦ Summary

Step Action
1 Verify Merchant feed ID structure (model/SKU)
2 Output same product ID in OpenCart events
3 Modify product.php and cart.php for consistency
4 Create GTM DLVs for ID, name, price
5 Configure Google Ads Remarketing tag with those values
6 Confirm match in Merchant Center
7 QA via GTM Preview and Google Tag Assistant


Leave a Reply

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