Dynamic Remarketing Tag Setup in osCommerce (Google Ads) via GTM — Full Implementation Guide

Standard

Dynamic Remarketing allows Google Ads to show personalized product ads to users based on what they viewed, added to cart, or purchased on your osCommerce store. When implemented via Google Tag Manager (GTM), this setup becomes scalable, structured, and easily customizable without direct code repetition.


✅ Benefits of Dynamic Remarketing in osCommerce

  • Serve personalized product ads based on user behavior
  • Boost ROAS by showing exact items users interacted with
  • Recover abandoned carts with precision
  • Enable product-level reporting and bidding

🧰 Prerequisites

  • Google Ads account with Merchant Center feed linked
  • Product feed contains unique IDs matching your store’s product SKUs or model numbers
  • Google Tag Manager installed on all osCommerce pages
  • Access to modify product_info.php, shopping_cart.php, checkout_success.php, etc.
  • Your Google Ads Conversion ID (AW-XXXXXXX)

📦 Step 1: Understand Required Parameters

Google Ads Dynamic Remarketing requires:

Parameter Description
ecomm_prodid Product ID (must match Merchant Center)
ecomm_pagetype Page type (e.g., product, cart)
ecomm_totalvalue Product or cart total price

🛒 Step 2: Inject Data Layer in Key Pages (PHP + JS)

You’ll need to inject page-specific dataLayer.push() calls on your osCommerce templates.


✅ Product Detail Page (product_info.php)

<?php
$product = getProductData($product_id); // Your PHP logic
?>
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: 'dynamic_remarketing',
  ecomm_pagetype: 'product',
  ecomm_prodid: '<?= $product['model'] ?>',
  ecomm_totalvalue: <?= $product['price'] ?>
});
</script>

✅ Cart Page (shopping_cart.php)

<?php
$cart_items = getCartItems();
$ids = array_column($cart_items, 'model');
$total = array_sum(array_column($cart_items, 'price'));
?>
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: 'dynamic_remarketing',
  ecomm_pagetype: 'cart',
  ecomm_prodid: <?= json_encode($ids) ?>,
  ecomm_totalvalue: <?= $total ?>
});
</script>

✅ Order Success Page (checkout_success.php)

<?php
$order = getOrderDetails($order_id);
$ids = array_column($order['products'], 'model');
$total = $order['total'];
?>
<script>
dataLayer.push({
  event: 'dynamic_remarketing',
  ecomm_pagetype: 'purchase',
  ecomm_prodid: <?= json_encode($ids) ?>,
  ecomm_totalvalue: <?= $total ?>
});
</script>

✅ Homepage (index.php)

<script>
dataLayer.push({
  event: 'dynamic_remarketing',
  ecomm_pagetype: 'home'
});
</script>

🏷️ Step 3: Create Data Layer Variables in GTM

Go to Variables → New → Data Layer Variable

GTM Variable Name Data Layer Variable Name
DL - ecomm_prodid ecomm_prodid
DL - ecomm_pagetype ecomm_pagetype
DL - ecomm_totalvalue ecomm_totalvalue

Set Data Layer Version: Version 2


🔧 Step 4: Configure Google Ads Remarketing Tag in GTM

  1. Go to Tags → New
  2. Choose: Google Ads Remarketing Tag
  3. Enter your Conversion ID (AW-XXXXXXX)
  4. Click “Enable dynamic remarketing”
  5. Business Type: Retail
  6. Map the parameters:
Parameter GTM Variable
ecomm_prodid {{DL - ecomm_prodid}}
ecomm_pagetype {{DL - ecomm_pagetype}}
ecomm_totalvalue {{DL - ecomm_totalvalue}}

🚀 Step 5: Add a Trigger for Dynamic Remarketing Events

  1. Go to Triggers → New
  2. Trigger Type: Custom Event
  3. Event Name: dynamic_remarketing
  4. Trigger fires on: All Custom Events

✅ Step 6: Test Your Implementation

🧪 In GTM:

  • Use Preview Mode
  • Visit a product page, cart, checkout
  • Confirm:
    • dynamic_remarketing event fires
    • Correct variables are populated in GTM

🧪 In Google Ads:

  • Use Google Tag Assistant and Conversion Debug Tool
  • Validate parameter values
  • Verify product IDs match those in Merchant Center

🔒 Optional: Use Consent Mode + GTM Server-Side

  • Use Consent Mode v2 to control firing under GDPR/CCPA
  • Route remarketing via Server-side GTM for improved match rates and privacy

📊 Suggested Use Cases for Audience Lists

Audience Type Remarketing Strategy
Viewed product but didn’t purchase Show product carousels (product ID)
Added to cart but didn’t check out Abandonment campaign with discounts
Viewed homepage only Branding or awareness push
Purchased recently Upsell or cross-sell campaigns

✅ Summary

With this implementation, you’ve enabled Google Ads Dynamic Remarketing in osCommerce using GTM:

  • ✅ Dynamic data layer across all funnel stages
  • ✅ Remarketing tag with correct product IDs and values
  • ✅ Fully testable, scalable, and Merchant Center-compatible

📁 Optional Enhancements

  • 🔁 Add custom parameters like category, brand
  • 🔄 Sync GA4 audiences to Google Ads for advanced targeting
  • 🧠 Use remarketing with Smart Display Campaigns or Performance Max

 

Leave a Reply

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