πŸš€ GA4 to Google Ads Integration: Custom Conversions in OpenCart

Standard

Integrating Google Analytics 4 (GA4) with Google Ads is a game changer for OpenCart merchants. With custom conversions, you can define your own success metrics, beyond just purchasesβ€”like form submissions, add-to-carts, or even scroll depthβ€”and import them into Google Ads for bidding and attribution.

βœ… Why Use Custom GA4 Conversions in Google Ads?

Feature Benefit
Track micro-conversions Add to cart, signup, scroll, etc.
Smarter bidding Optimize for user intent, not just purchases
Full funnel visibility Understand pre-purchase behavior
Flexible attribution Control which signals matter to Google Ads


🧰 Requirements

  • GA4 property configured
  • GTM web container implemented in OpenCart
  • Google Ads and GA4 linked in the same Google account
  • Event dataLayer pushes in OpenCart (e.g., add_to_cart, begin_checkout)
  • GTM setup to fire GA4 custom events


🧩 Example Use Case: Add-to-Cart as a Custom Conversion

Let’s say we want to:

  • Send a custom add_to_cart event from OpenCart to GA4
  • Mark it as a conversion
  • Use it in Google Ads for audience building and bidding


πŸ”Ή Step 1: Push add_to_cart to dataLayer in OpenCart

In catalog/controller/checkout/cart.php, after the product is added:

$product_info = $this->model_catalog_product->getProduct($product_id);
$data['gtm_add_to_cart'] = json_encode([
'event' => 'add_to_cart',
'ecommerce' => [
'currency' => $this->session->data['currency'],
'value' => $product_info['price'],
'items' => [[
'item_id' => $product_info['model'], // Match Merchant Center
'item_name' => $product_info['name'],
'price' => $product_info['price'],
'quantity' => $quantity
]]
]
]);

Then in cart.twig (or output file):

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


πŸ”Ή Step 2: Setup GA4 Event Tag in GTM

In Google Tag Manager:

  1. Tag Type: GA4 Event
  2. Configuration Tag: Your GA4 base config
  3. Event Name: add_to_cart (must match what you push)
  4. Event Parameters:
    • currency: {{DLV - ecommerce.currency}}
    • value: {{DLV - ecommerce.value}}
    • items: {{DLV - ecommerce.items}}
  5. Trigger:
    • Type: Custom Event
    • Event Name: add_to_cart

Create all data layer variables as needed:

  • ecommerce.currency
  • ecommerce.value
  • ecommerce.items.0.item_id, etc.

βœ… This sends the structured add_to_cart event to GA4 with all necessary parameters.


πŸ”Ή Step 3: Verify in GA4 DebugView

  • Go to GA4 β†’ Admin β†’ DebugView
  • Add a product to cart
  • Confirm add_to_cart event fires with:
    • value, currency, and item_id


πŸ”Ή Step 4: Mark the Custom Event as a Conversion in GA4

  1. In GA4 Admin β†’ Events
  2. Locate add_to_cart in the list
  3. Toggle the Mark as Conversion switch ON

βœ… GA4 now treats this event as a conversion and can send it to Google Ads.


πŸ”Ή Step 5: Link GA4 with Google Ads

In GA4 Admin:

  1. Go to Product Links β†’ Google Ads
  2. Click Link and choose your Ads account
  3. Enable:
    • Personalized Advertising
    • Auto-tagging
    • Enable conversion import

βœ… GA4 events marked as conversions will now be available in Ads.


πŸ”Ή Step 6: Import Conversions into Google Ads

  1. Go to Google Ads β†’ Tools & Settings β†’ Conversions
  2. Click New Conversion Action β†’ Import β†’ Google Analytics 4 properties (Web)
  3. Select add_to_cart or any other GA4-marked conversion
  4. Assign a value or use the one from GA4

βœ… Done! Your GA4 custom conversion is now available in Google Ads for:

  • Smart bidding
  • Audience segmentation
  • Campaign performance tracking


🎯 Use Cases for Custom Conversions in OpenCart

Custom Event Strategy
add_to_cart Target cart abandoners
view_item Product-based engagement
begin_checkout Pre-purchase signals
newsletter_signup Lead-gen retargeting
form_submit Micro-conversions in B2B stores


🧠 Pro Tips

  • Name events consistently in dataLayer, GTM, and GA4
  • Use transaction_id in purchase events to prevent duplicates
  • GA4 sends conversions with event timestamp, ensuring accurate attribution
  • Always test each step in GTM preview and GA4 DebugView before importing to Ads


πŸ§ͺ QA Checklist

Task βœ…
add_to_cart fires in dataLayer βœ…
GA4 event tag sends event correctly βœ…
Event visible in DebugView βœ…
Event marked as conversion βœ…
Imported to Google Ads βœ…
Conversion appears in Ads reports βœ…


πŸ“¦ Summary Table

Step Description
1 Push GA4-style event into OpenCart dataLayer
2 Fire GA4 event tag in GTM
3 Mark the event as a conversion in GA4
4 Link GA4 to Google Ads
5 Import the custom event into Ads
6 Use it for bidding, targeting, and reports


Leave a Reply

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