Stape Alternative with Unlimited Events: Self-Host Your GTM Tagging Server

This tutorial walks through a real deployment, screenshot by screenshot: a server-side Google Tag Manager instance running on your own Dublyo server atgtm.yourdomain.com, with automatic HTTPS, a dedicated preview server for debugging, and a Custom Loader path that servesgtm.js from your own domain to bypass ad blockers.

Hosted sGTM providers such as Stape meter you by monthly requests — grow your traffic and your bill grows with it. Self-hosting flips that model:unlimited events for the flat price of the server, because the tagging server runs on hardware you already pay for. No per-event pricing, no request caps, no Google Cloud bill, and your analytics data never transits a third party's infrastructure.

The whole process takes about ten minutes, and Dublyo automates the parts that make manual sGTM hosting painful — TLS certificates, the preview server, and custom-loader path rewriting.

You need three things: a running Dublyo server (2 GB RAM or more — Standard tier recommended), a domain whose DNS you control, and a Google Tag Manager account. If you don't have a server yet,create one first.

Step 1 — Create a Server container in Google Tag Manager

Open tagmanager.google.com. You'll see your account with its existing Web container — the tagging server gets a separate container of type Server.

Google Tag Manager home showing an account with a Web container

Open the account's ⋮ actions menu → Create Container. Name it after your site (for example yoursite.com - server) and pickServer as the target platform.

Create Container dialog with the Server target platform selected

Step 2 — Choose manual provisioning and copy the Container Config

As soon as the container is created, GTM asks how you want to provision the tagging server. Choose Manually provision tagging server — Dublyo is your server. GTM reveals a long Container Configstring. Copy it; it's the one value the Dublyo form needs.

Manually provision tagging server selected, revealing the Container Config string
Treat the Container Config like a credential. It contains an auth token for your container. Don't publish it or commit it anywhere — it's blurred in this screenshot for the same reason. If it ever leaks, generate a fresh one from Admin → Container Settings.

Step 3 — Fill the deployment form on Dublyo

In the Dublyo dashboard, openGTM Serverin the sidebar and click + New GTM Container.

Dublyo GTM Server-Side dashboard

The form has four parts:

FieldWhat to enter
ServerThe running server that will host the container.
DomainThe first-party hostname your tags will load from, e.g. gtm.yourdomain.com. Subdomains of your real site domain keep cookies first-party.
Container ConfigPaste the string you copied from GTM in step 2.
Custom Loader PathThe path that serves gtm.js from your domain (default loader/script.js). Ad blockers filter requests to googletagmanager.com; they don't filter your own domain.

Power-ups are optional server-side enhancements you can toggle per container — in this walkthrough we enabled Cookie Keeper (extends cookie lifetime past Safari ITP's 7-day cap) and Bot Detection(flags crawler traffic with an X-Bot header). User ID andIP Blocklist can be switched on later from the container page.

The full Dublyo GTM creation form: server, domain, DNS instructions, container config and power-ups

Step 4 — Point your DNS and verify

As soon as you type the domain, Dublyo shows the exact DNS record to create at your registrar:

TypeNameValueTTL
Agtmyour server's IP (shown in the form)Auto
Using Cloudflare? Set the record toDNS only (grey cloud). The certificate is issued on your server via Let's Encrypt, and the challenge fails behind Cloudflare's proxy.

Add the record, give it a minute to propagate, then clickVerify DNS:

DNS verified — the domain resolves correctly to the server

Step 5 — Deploy

Click Deploy GTM Container. Dublyo takes it from here — in under a minute it:

1
Starts the sGTM tagging server, the preview server, and the power-up proxy on your server
2
Issues a Let's Encrypt certificate for your domain automatically
3
Creates a dedicated preview hostname (preview-gtm-…​.dublyo.co) — no DNS work needed on your side
4
Wires the Custom Loader path so /loader/script.js serves gtm.js from your domain

The container page shows everything at a glance once it's running:

Dublyo container page: running status, domain, preview URL, custom loader URL, setup steps and power-ups

Quick sanity check — your tagging server answers on its health endpoint:

curl https://gtm.yourdomain.com/healthz   # → ok (HTTP 200)

Step 6 — Publish the container and connect your website

Back in Google Tag Manager, press Submit → Publish on the new server container so it has a live version. Then connect your existingWeb container to the tagging server: in your GA4 configuration tag, set server_container_url (transport URL) tohttps://gtm.yourdomain.com, and load the GTM snippet from your Custom Loader URL instead of googletagmanager.com.

The container page's Setup & Configuration section (previous screenshot) lists these steps with copy-paste snippets for your exact domain, and the full GTM Server-Side guide covers web-container wiring, the preview workflow and every power-up in depth.

Your container now appears on the GTM dashboard, fully manageable — stop, restart or delete it any time:

Dublyo GTM dashboard listing the running container

Step 7 — Verify with real events

The strongest proof is a real event stream. Open Preview on your server container in GTM (Tag Assistant), copy thex-gtm-server-preview header value it gives you, and replay a full e-commerce funnel against your own tagging server from the command line:

PREVIEW='paste-your-x-gtm-server-preview-value'
for EN in page_view view_item add_to_cart begin_checkout add_payment_info purchase; do
  curl -s -o /dev/null -w "$EN → %{http_code}\n" \
    -H "x-gtm-server-preview: $PREVIEW" \
    "https://gtm.yourdomain.com/g/collect?v=2&tid=G-1234&cid=555.777&en=$EN&cu=USD&epn.value=139.97&ep.transaction_id=T-10001&pr1=idSKU_1~nmHoodie~pr59.99~qt2"
done

Every request should return 200 — and each event appears live in Tag Assistant with its full payload parsed: the GA4 client claiming the request, currency, transaction ID, coupon and the completeitems array. This is the exact funnel above, received by the tagging server from this tutorial:

Tag Assistant preview on the self-hosted server: the event sidebar lists the full funnel and the purchase event shows the GA4 client claiming it with currency, coupon, session and items data

Note the response cookie on collect requests: FPID is set server-side (HttpOnly, Secure) — and with the Cookie Keeper power-up enabled its lifetime is the 400 days you configured, not the 7 days Safari ITP would allow a script-set cookie.

Troubleshooting

SymptomCause & fix
Loader URL shows an error in the browserExpected. /loader/script.js needs the ?id=GTM-XXXXXX parameter, which the snippet appends automatically. A bare visit returns HTTP 400.
Verify DNS keeps failingThe record must be a direct A record to the server IP — on Cloudflare that means grey cloud. Propagation can take a few minutes.
Requests return 400 from the serverThe server container has no published version yet, or the request doesn't match any client. Press Submit → Publish in GTM.
Certificate warning right after deployLet's Encrypt issuance takes up to a minute after the first request. Reload shortly after.
Stuck? Reach us on WhatsApp 24/7 — or deploy a fresh container and delete the old one; containers are disposable.