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
)
- Your landing page domain (e.g.,
- 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
- In GTM, go to Tags β GA4 Configuration
- Click to Edit Tag
- Expand Fields to Set
- 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:
- Expand Advanced Settings β Tag Sequencing
- 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
- Go to GA4 Admin β Data Streams β Your Web Stream
- Scroll to Configure tag settings
- Click “Configure your domains”
- Add:
promo.example.com
shop.example.com
- Save changes
This tells GA4 which domains to treat as the same session context.
π§ Step 5: Test Cross-Domain Flow
β Use GTM Preview Mode:
- Navigate to the landing page
- Click a CTA link to go to the osCommerce site
- Ensure the URL contains a
_gl
parameter (e.g.?_gl=1*abc123...
) - 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
orpage_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