Enhanced Conversions help Google Ads recover conversion attribution lost due to privacy restrictions or third-party cookie limitations by sending hashed first-party customer data (e.g., email, phone, name) directly to Google. In osCommerce, implementing this via Google Tag Manager (GTM) ensures flexibility, privacy compliance, and minimal code repetition.
π― Why Use Enhanced Conversions?
- Improves attribution accuracy
- Boosts match rates for conversions (especially on iOS/Safari)
- Supports smart bidding & remarketing effectiveness
- Works with both standard and server-side GTM setups
β Prerequisites
- Google Ads Conversion Action already created
- GTM installed on all osCommerce pages
checkout_success.php
editable- Customer data (email, phone, etc.) available on order confirmation
- GDPR/CCPA consent compliance in place (where applicable)
π§Ύ Step 1: Push Customer Data into the Data Layer (on Purchase)
In your checkout_success.php
file, inject the customer data securely:
β PHP + JavaScript Example:
<?php
$order = getOrderDetails($order_id);
?>
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
event: 'purchase',
transaction_id: '<?= $order['id'] ?>',
value: <?= $order['total'] ?>,
currency: 'USD',
user_data: {
email: "<?= $order['customer_email'] ?>",
phone_number: "<?= $order['customer_phone'] ?>",
first_name: "<?= $order['customer_firstname'] ?>",
last_name: "<?= $order['customer_lastname'] ?>",
address: {
street: "<?= $order['customer_address'] ?>",
city: "<?= $order['customer_city'] ?>",
region: "<?= $order['customer_state'] ?>",
postal_code: "<?= $order['customer_zip'] ?>",
country: "<?= $order['customer_country'] ?>"
}
}
});
</script>
β οΈ Ensure that this is done only after explicit user consent where required.
π·οΈ Step 2: Create Data Layer Variables in GTM
Go to Variables β New β Data Layer Variable. Create the following:
Variable Name | Data Layer Variable Name |
---|---|
DL - email |
user_data.email |
DL - phone_number |
user_data.phone_number |
DL - first_name |
user_data.first_name |
DL - last_name |
user_data.last_name |
DL - address_street |
user_data.address.street |
DL - address_city |
user_data.address.city |
DL - address_region |
user_data.address.region |
DL - address_postal_code |
user_data.address.postal_code |
DL - address_country |
user_data.address.country |
π§ Step 3: Create the Google Ads Conversion Tag with Enhanced Conversions
- Go to Tags β New
- Choose Google Ads Conversion Tracking
- Enter your Conversion ID and Label
- Click βInclude Enhanced Conversionsβ
- Select: “Use data layer”
- Map the variables:
Enhanced Field | GTM Variable |
---|---|
{{DL - email}} |
|
Phone Number | {{DL - phone_number}} |
First Name | {{DL - first_name}} |
Last Name | {{DL - last_name}} |
Street Address | {{DL - address_street}} |
City | {{DL - address_city}} |
Region | {{DL - address_region}} |
Postal Code | {{DL - address_postal_code}} |
Country | {{DL - address_country}} |
- In the tag’s Conversion Value, use:
{{DL - value}}
(set this up as a DL variable too)
- Trigger: Use a Custom Event Trigger for
purchase
π Step 4: Configure Trigger for Purchase Event
- Go to Triggers β New
- Choose: Custom Event
- Event name:
purchase
- Name it:
Trigger - Purchase Event
π§ͺ Step 5: Test the Enhanced Conversion Setup
β Use GTM Preview:
- Navigate to the thank-you page
- Ensure:
purchase
event is pushed- Google Ads Conversion tag fires
β Use Googleβs Enhanced Conversions Helper:
- Go to: https://ads.google.com/aw/conversions/ec/setup
- Validate whether enhanced data is passing
β Chrome DevTools Check:
- Open Network tab β XHR
- Look for request to
googleads.g.doubleclick.net
- Check payload includes hashed values (e.g.,
em
,ph
)
π Step 6: Privacy & Consent Considerations
To be GDPR/CCPA-compliant:
- Only push
user_data
to the data layer after user consent - Use a Consent Management Platform (CMP) with GTM (e.g., Cookiebot, OneTrust)
- Integrate with Consent Mode v2 in Google
π§ Pro Tips for osCommerce Integration
Tip | Benefit |
---|---|
Hash data before pushing to GTM (optional) | Adds extra privacy on frontend |
Combine with GA4 purchase tracking | One tag β multiple destinations |
Implement via GTM Server-Side | Even higher attribution & privacy control |
β Summary
With this setup, you now have:
- β Accurate Google Ads purchase conversion tracking
- β Enhanced Conversions via GTM using first-party customer data
- β Scalable, privacy-compliant setup for osCommerce
π Optional Add-ons
- π Server-side GTM setup for Enhanced Conversions
- π GA4 to Google Ads audience syncing
- π Dynamic Remarketing using product data in osCommerce