Cross-Domain Conversion Tracking for osCommerce & Landing Pages using GA4 + GTM

Standard

If your marketing flow includes separate landing pages (e.g., on Unbounce, Webflow, or custom domains) that redirect users to your osCommerce store, standard GA4 tracking won’t capture the user session properly β€” leading to broken attribution and missed conversions.

This guide walks you through implementing cross-domain tracking using Google Analytics 4 (GA4) and Google Tag Manager (GTM), ensuring full-funnel visibility from click to purchase.


🎯 Why Cross-Domain Tracking Matters in osCommerce

Without Cross-Domain Tracking With Cross-Domain Tracking
Sessions split between domains Single, unified session across domains
β€œDirect” or β€œ(not set)” traffic sources Correct attribution to source/medium
Inaccurate conversions in Google Ads Accurate ROAS and assisted conversions
Incomplete funnel in GA4 Full view of user journey

βœ… Prerequisites

  • GA4 and GTM installed on:
    • Your landing page domain (e.g., promo.example.com)
    • Your osCommerce store (e.g., shop.example.com)
  • Both domains are under your control
  • GA4 configuration tag already firing on both
  • Shared GTM container or synced setups

🧭 Step 1: Configure GA4 Cross-Domain Measurement in GTM

πŸ”§ Edit Your GA4 Configuration Tag

  1. In GTM, go to Tags β†’ GA4 Configuration
  2. Click to Edit Tag
  3. Expand Fields to Set
  4. Click Add Row
Field Name Value
linker true
linker_domains shop.example.com

(On the store side, use promo.example.com instead if needed)


πŸ§ͺ Example GA4 Config Field Setting in GTM:

[
{ fieldName: "linker", value: true },
{ fieldName: "linker_domains", value: "shop.example.com" }
]

This ensures GA4 passes the _gl parameter between domains to stitch sessions together.

🌍 Step 2: Enable Auto Link Decorator in GTM

In the GA4 Configuration Tag:

  1. Expand Advanced Settings β†’ Tag Sequencing
  2. Ensure this tag fires before other event tags

Alternatively, enable automatic link decoration in the GA4 config itself:

  • Add a trigger to listen for clicks and pass the decorated link using GA4’s linker.

πŸ”— Step 3: Modify Outbound Links on Landing Pages (if needed)

GA4 should auto-decorate links pointing to your osCommerce store. But you can also manually add linker parameters using GTM or JavaScript.

βœ… Example: Manual Link Decoration (if JS injection is possible)

<script>
window.addEventListener('DOMContentLoaded', function () {
var links = document.querySelectorAll('a[href*="shop.example.com"]');
links.forEach(function (link) {
link.href = gtag.get('linker').decorate(link.href);
});
});
</script>

🧾 Step 4: Enable Cross-Domain Measurement in GA4 Admin

  1. Go to GA4 Admin β†’ Data Streams β†’ Your Web Stream
  2. Scroll to Configure tag settings
  3. Click “Configure your domains”
  4. Add:
    • promo.example.com
    • shop.example.com
  5. Save changes

This tells GA4 which domains to treat as the same session context.


🧠 Step 5: Test Cross-Domain Flow

βœ… Use GTM Preview Mode:

  1. Navigate to the landing page
  2. Click a CTA link to go to the osCommerce site
  3. Ensure the URL contains a _gl parameter (e.g. ?_gl=1*abc123...)
  4. Open DevTools β†’ Application β†’ Cookies β†’ Check that GA4 client ID remains consistent across domains

βœ… Use GA4 DebugView:

  • Confirm all events (from landing page to purchase) flow into a single session

πŸ§ͺ Bonus: Push Purchase Data on osCommerce Checkout

In checkout_success.php:

<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: "<?= $order['id']; ?>",
value: <?= $order['total']; ?>,
currency: "USD",
items: <?= json_encode($order['products']); ?>
}
});
</script>

Create a GA4 Event tag in GTM for purchase to finalize the conversion.


πŸ” Step 6: Consent Mode & Privacy Compliance (if needed)

  • Use Consent Mode v2 in GTM if users are in GDPR/CCPA regions
  • Ensure _gl parameters are passed only after consent, or anonymize link decoration

πŸ“Š Post-Setup: How to Use the Data

In GA4:

  • Use Exploration Reports to visualize cross-domain sessions
  • Filter by page_location or page_referrer to see journeys
  • Use Attribution > Conversion Paths for assisted conversions

In Google Ads:

  • Use GA4-linked conversions
  • Create remarketing audiences based on full-funnel behavior

βœ… Summary

With this setup, you’ve enabled accurate cross-domain tracking between your landing pages and osCommerce store, enabling:

  • βœ… Unified user journey across domains
  • βœ… Accurate session attribution for Google Ads
  • βœ… Enhanced conversions and retargeting visibility

πŸ“ Optional Add-ons

  • πŸ”„ Setup server-side GTM to capture linker data with higher accuracy
  • πŸ” Use GA4 audiences to retarget product viewers via Google Ads
  • πŸ“‰ Create Looker Studio dashboards with full funnel + attribution paths

Leave a Reply

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