● LIVE
OpenAI releases GPT-5 APIIndia AI startup raises $120MBitcoin ETF hits record inflowsMeta Llama 4 benchmarks leakedOpenAI releases GPT-5 APIIndia AI startup raises $120MBitcoin ETF hits record inflowsMeta Llama 4 benchmarks leaked
📅 Mon, 23 Mar, 2026✈️ Telegram
AiFeed24

AI & Tech News

🔍
✈️ Follow
🏠Home🤖AI💻Tech🚀Startups₿Crypto🔒Security🇮🇳India☁️Cloud🔥Deals
✈️ News Channel🛒 Deals Channel
How I Set Up Server-Side GTM Tracking with Stape.io, GA4 and Google Ads on a Drupal 11 Marketplace
☁️Cloud & DevOps

How I Set Up Server-Side GTM Tracking with Stape.io, GA4 and Google Ads on a Drupal 11 Marketplace

Home/Cloud & DevOps/How I Set Up Server-Side GTM Tracking with Stape.io, GA4 and Google Ads on a Drupal 11 Marketplace

When I relaunched Parksy — a two-sided parking marketplace — on Drupal 11, I knew I needed rock-solid conversion tracking. Browser-side GTM alone wasn't going to cut it. Ad blockers, iOS privacy changes, and cookie restrictions were killing data quality. So I went full server-side. The Stack Step 1:

⚡Quick SummaryAI generating...
D

Daniel Battaglia

📅 Mar 23, 2026·⏱ 4 min read·Dev.to ↗
✈️ Telegram𝕏 TweetWhatsApp
📡

Original Source

Dev.to

https://dev.to/daniel_battaglia/how-i-set-up-server-side-gtm-tracking-with-stapeio-ga4-and-google-ads-on-a-drupal-11-marketplace-3680
Read Full ↗

When I relaunched Parksy — a two-sided parking marketplace — on Drupal 11, I knew I needed rock-solid conversion tracking. Browser-side GTM alone wasn't going to cut it. Ad blockers, iOS privacy changes, and cookie restrictions were killing data quality. So I went full server-side.
Here's exactly how I set it up using Stape.io as my GTM server container host, with GA4 and Google Ads conversion tracking firing server-side.

The Stack
Drupal 11 (custom parksy_gtm module for dataLayer events)
GTM web container (GTM-KNDDDKM9) — client-side tag management
GTM server container hosted on Stape.io — receives and forwards events
GA4 — analytics destination
Google Ads — conversion tracking destination

Step 1: Set Up a Server Container on Stape.io
Stape.io makes hosting a GTM server container easy without managing your own GCP instance.

Create an account at stape.io
Create a new GTM Server Container
Stape provisions a subdomain like gtm.yourdomain.com — point a CNAME DNS record to it
Copy the Container Config string from Stape and paste it into your GTM server container settings

Your server container is now live and ready to receive events.

Step 2: Configure the Web Container to Send to the Server
In your GTM web container, set up a GA4 Configuration tag but point the server container URL to your Stape endpoint instead of Google directly.
This routes all GA4 hits through your server first — giving you full control over what gets forwarded and letting you enrich events server-side.

cloud bubble of mixed tech

Step 3: Push dataLayer Events from Drupal
I built a small custom Drupal module (parksy_gtm) that hooks into key events and pushes them to the dataLayer:
phpfunction parksy_gtm_user_register(array &$edit, UserInterface $account)

{
  $response = new AttachedAssets();
  drupal_add_js([
    'event' => 'sign_up',
    'method' => 'email',
    'user_id' => $account->id(),
  ], 'setting');
}

The three core events I track:

sign_up — new user registration
add_to_cart — user views the subscribe page
purchase — Stripe/PayPal subscription confirmed

Each event carries relevant parameters (user ID, plan type, value) so GA4 and Google Ads get clean, structured data.

Step 4: Set Up GA4 in the Server Container
In the server GTM container:

Add a GA4 client — this receives incoming GA4 hits from the web container
Add a GA4 tag pointing to your Measurement ID (G-XXXXXXXXXX)
Map the incoming event parameters to GA4 event parameters

Now GA4 events are being sent from your server IP, not the user's browser — bypassing most ad blockers.

magnifying glass focus on data

Step 5: Google Ads Conversion Tracking Server-Side
This is where it gets powerful. Instead of relying on the browser-based Google Ads conversion tag (which frequently gets blocked), you fire conversions from the server.
In the server GTM container:

Add a Google Ads Conversion Tracking tag
Set your Conversion ID (AW-XXXXXXXXX) and Conversion Label
Trigger it on the purchase event from your GA4 client
Map transaction_id, value, and currency from the event data

Google Ads now receives purchase conversions directly from your server — far more reliable than client-side.

Step 6: Enhanced Conversions (Optional but Recommended)
To improve match rates, pass hashed user data alongside conversions. In Drupal, hash the email at the point of purchase:
php$hashed_email = hash('sha256', strtolower(trim($account->getEmail())));
Push this into the dataLayer as user_data.email and map it through GTM to the Google Ads enhanced conversions field. This significantly improves attribution, especially on iOS.

Results
After switching to server-side tracking on Parksy:

Conversion data gaps from ad blockers effectively eliminated
Google Ads reporting became consistent with actual Stripe revenue
GA4 session data quality improved noticeably

If you're running a marketplace or any site where conversion accuracy directly affects ad spend decisions, server-side GTM is worth the setup effort.
Happy to answer questions in the comments — especially around the Drupal dataLayer integration or Stape.io configuration.

Tags:#cloud#dev.to

Found this useful? Share it!

✈️ Telegram𝕏 TweetWhatsApp

Read the Full Story

Continue reading on Dev.to

Visit Dev.to ↗

Related Stories

☁️
☁️Cloud & DevOps

Hiring Senior Full Stack Developer (Remote, USA)

12 minutes ago

☁️
☁️Cloud & DevOps

How I Built a Multi-Tenant WhatsApp Automation Platform Using n8n and WAHA

13 minutes ago

☁️
☁️Cloud & DevOps

I Built an Instant SEO Audit API — Here's What I Learned About Technical SEO

17 minutes ago

☁️
☁️Cloud & DevOps

SJF4J: A Structured JSON Facade for Java

17 minutes ago

📡 Source Details

Dev.to

📅 Mar 23, 2026

🕐 about 1 hour ago

⏱ 4 min read

🗂 Cloud & DevOps

Read Original ↗

Web Hosting

🌐 Hostinger — 80% Off Hosting

Start your website for ₹69/mo. Free domain + SSL included.

Claim Deal →

📬 AiFeed24 Daily

Top 5 AI & tech stories every morning. Join 40,000+ readers.

✦ 40,218 subscribers · No spam, ever

Cloud Hosting

☁️ Vultr — $100 Free Credit

Deploy cloud servers in 25+ locations. From $2.50/mo. No contract.

Claim $100 Credit →
AiFeed24

India's AI-powered tech news hub. Daily coverage of AI, startups, crypto and emerging technology.

✈️🛒

Topics

Artificial IntelligenceStartups & VCCryptocurrencyCybersecurityCloud & DevOpsIndia Tech

Company

About AiFeed24Write For UsContact

Daily Digest

Top 5 AI stories every morning. 40,000+ readers.

No spam, ever.

© 2026 AiFeed24 Media.Affiliate Disclosure — We earn commission on qualifying purchases at no extra cost to you.
PrivacyTermsCookies