Deploy Server-Side GTM on Dublyo
Host your own server-side Google Tag Manager instance with a custom domain, ad-blocker bypass via Custom Loader, and a dedicated preview server for debugging — all on your own cloud server.
Server-side GTM moves tag processing from the visitor's browser to your own server. This improves page load speed, gives you full control over data collection, and lets you bypass client-side ad blockers. Dublyo automates the entire deployment — including HTTPS certificates, preview server, and Custom Loader path rewriting.
gtm.example.com). The default *.dublyo.co subdomain is not supported for GTM deployments. You'll need to own a domain and configure DNS before deploying. What is Server-Side GTM?
Google Tag Manager (GTM) traditionally runs in the browser. Every tag (Google Analytics, Facebook Pixel, conversion tracking, etc.) loads JavaScript in the visitor's browser, which slows down the page and is easily blocked by ad blockers.
Server-side GTM (sGTM) moves this processing to a server you control. Instead of loading dozens of tracking scripts in the browser, you send one request to your sGTM server, which then fans out to Google Analytics, Facebook, and other destinations server-to-server.
Benefits
- Faster pages — fewer scripts loading in the browser means better Core Web Vitals
- Ad-blocker bypass — tracking runs on your own domain, so it's not blocked by browser extensions
- Data control — you see and control exactly what data leaves your server
- Longer cookie lifetimes — first-party cookies set by your server last longer than third-party cookies
- Better data quality — server-side processing is more reliable than client-side
How It Works on Dublyo
Each GTM deployment on Dublyo creates two containers on your server:
| Container | Role | Domain |
|---|---|---|
| sGTM (Production) | Processes tags and forwards data to analytics services | Your custom domain (e.g., gtm.example.com) |
| sGTM (Preview) | Debug/preview server for testing tag changes in GTM | Auto-generated *.dublyo.co subdomain |
Requirements
Before deploying sGTM, make sure you have the following:
| Requirement | Minimum | Recommended |
|---|---|---|
| Server Type | Starter (2 vCPU, 4 GB RAM) | Standard (4 vCPU, 8 GB RAM) |
| Use Case | Low-traffic site, basic tracking | Multiple tags, moderate traffic |
| Custom Domain | Required — *.dublyo.co is not supported for GTM | |
| Google GTM Account | A GTM Server Container with a Container Config string | |
A Starter server works for low-traffic sites. For production use with multiple tags and moderate traffic, choose a Standard server or higher. Each sGTM deployment uses approximately 1.5 vCPU and 768 MB RAM.
How to Get Your Container Config
The Container Config is a base64-encoded string from Google that links your deployed sGTM instance to your GTM server container. Here's how to get it:
Open Google Tag Manager
Go to tagmanager.google.com and select your account.
Create or select a Server Container
If you don't have one yet, create a new container and choose "Server" as the target platform. If you already have one, select it.
Go to Container Settings
Click Admin in the top navigation, then click Container Settings.
Copy the Container Config
You'll see a Container Config field with a long base64-encoded string (starts with aG...). Copy this entire string — you'll paste it during the Dublyo deployment wizard.
Deploy GTM
GTM deployment on Dublyo follows a guided 3-step process. You'll need your custom domain and Container Config ready before starting.
Step 1: Select Server
Go to GTM Server
Navigate to GTM Server in the sidebar, then click "+ New GTM Container".
Choose a running server
Select a server from the dropdown. Only running servers are shown. The server's IP address will be displayed — you'll need it for DNS configuration.
Step 2: Configure Domain & DNS
Enter your GTM domain
Type your custom domain (e.g., gtm.example.com). The *.dublyo.co subdomain is not supported for GTM.
Add a DNS A record
Go to your domain registrar and create an A record pointing to your server's IP address:
| Type | Name | Value | TTL |
|---|---|---|---|
| A | gtm (or your subdomain) | Your server IP | Auto (or 300) |
Verify DNS
Click "Verify DNS" to check the A record. It must pass before you can proceed. DNS propagation usually takes a few minutes.
Step 3: GTM Configuration
Enter container name and config
Give your container a name (e.g., "Production GTM") and paste the Container Config string you copied from Google Tag Manager.
Set Custom Loader path (optional)
The Custom Loader path defaults to loader/script.js. This rewrites to gtm.js on the server side, bypassing ad blockers. You can customize this path to anything you like.
Click Deploy GTM Container
Hit the deploy button. Provisioning starts immediately and you'll be redirected to the container management page where you can track progress.
Connect Your Web Container
Google Tag Manager uses two container types: a Web container (runs in the browser) and a Server container (runs on your server). Your Server container config was provided during deployment. Now you need to connect your Web container to your server-side endpoint.
Step 1: Set the Server Container URL
Open your Web container
Go to tagmanager.google.com and open your Web container (not the Server container).
Go to Container Settings
Click Admin in the top navigation, then Container Settings.
Set the Server container URL
Under Server container URL, enter your custom domain:
https://gtm.example.comThis tells the Web container to route all tag requests through your server-side domain instead of directly to Google.
Step 2: Get Your Web Container ID
Your Web container ID looks like GTM-ABC123. You can find it in the same Admin → Container Settings page, or in the top-right corner of the GTM interface. You'll need this ID for the tracking snippet.
GTM-ABC123) in your website snippet — not the Server container ID. The Server container is connected via the Container Config you entered during deployment. Step 3: Install the Tracking Snippet
Add the Custom Loader snippet to your website's <head> section. The exact snippet with your domain and loader path is shown on your container's management page in the Dublyo dashboard. It looks like this:
<!-- Google Tag Manager (server-side via Dublyo) --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true; j.src='https://gtm.example.com/loader/script.js?id='+i+dl; f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer', 'GTM-ABC123');</script> Replace gtm.example.com with your actual domain and GTM-ABC123 with your Web container ID.
https://gtm.example.com/loader/script.js) returns HTTP 400 — this is normal. The URL requires the ?id=GTM-XXXXXX parameter, which the snippet adds automatically. Custom Loader (Ad-Blocker Bypass)
The Custom Loader is one of the most powerful features of server-side GTM. It lets you serve the GTM JavaScript from a custom path on your own domain, making it invisible to ad blockers.
How It Works
Normally, the GTM snippet loads JavaScript from https://www.googletagmanager.com/gtm.js. Ad blockers recognize this URL and block it. With the Custom Loader:
- Your GTM snippet loads from
https://gtm.example.com/loader/script.js(your domain) - Traefik rewrites this path to
/gtm.json the sGTM container - The browser sees a first-party request to your domain — ad blockers don't block it
Using the Custom Loader
After deployment, update your website's GTM snippet to load from your custom domain. The management page shows the exact snippet to use. Replace the default Google URL:
// Instead of: j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl; // Use: j.src='https://gtm.example.com/loader/script.js?id='+i+dl;The full snippet is available on your container's management page with a copy button.
analytics/main.js or scripts/track.js. Choose something that blends naturally with your site's URL structure. Power-ups
Power-ups are open-source enhancements that run as a lightweight proxy between Traefik and your sGTM container. They add features like extended cookie lifetimes, anonymous user tracking, bot detection, and IP filtering — all without modifying your GTM tags or configuration.
Power-ups are free and included with every GTM deployment. You can enable or disable them anytime from the management page. Changes trigger an automatic redeploy.
Available Power-ups
| Power-up | What It Does | When to Use |
|---|---|---|
| Cookie Keeper | Rewrites Set-Cookie Max-Age headers to extend cookie lifetimes beyond Safari ITP and Brave restrictions (default: 400 days) | You need accurate attribution across Safari/Brave sessions |
| User ID | Generates a deterministic anonymous user ID from IP + User-Agent + a secret salt using SHA-256 (first 16 hex chars). Injected as the X-Stape-User-Id header. | You want cross-session user deduplication without relying on cookies |
| Bot Detection | Matches User-Agent strings against 50+ known bot patterns (crawlers, scrapers, headless browsers). Adds an X-Bot: true header. Optionally returns HTTP 403 to block bots entirely. | You want to clean bot traffic from your analytics data |
| IP Blocklist | Blocks specific IP addresses or CIDR ranges from reaching your sGTM. Useful for filtering internal traffic or known bad actors. | You want to exclude office IPs or known spam sources |
Enabling Power-ups
Go to your GTM container management page
Navigate to GTM Server in the sidebar and click on your container.
Toggle the power-ups you want
Scroll to the Power-ups card. Toggle on the power-ups you need and configure their settings (e.g., Cookie Keeper max-age, Bot Detection block mode, IP addresses to block).
Click Save & Redeploy
The button appears when you make changes. Clicking it saves the config and redeploys the container. The proxy container is added or removed automatically based on whether any power-up is enabled.
Preview Mode
Every GTM deployment on Dublyo includes a dedicated preview server. This is essential for testing and debugging your server-side tags before publishing changes.
How Preview Works
The preview server runs as a separate container with the same Container Config but with RUN_AS_PREVIEW_SERVER=true. It's accessible on an auto-generated *.dublyo.co subdomain with HTTPS.
Using Preview Mode
Open GTM and enter Preview mode
In Google Tag Manager, click Preview in the top right. This opens the Tag Assistant.
Enter your website URL
Enter the URL of the website that has your GTM snippet installed. The Tag Assistant will connect to your preview server automatically — the production container already knows your preview URL.
Debug your tags
Browse your website normally. The Tag Assistant shows every tag firing, every variable value, and every trigger condition in real time. Fix issues before publishing.
Troubleshooting
Running into issues with your sGTM deployment? Here are solutions to the most common problems.
DNS Verification Failing
- Make sure the A record points to the correct server IP
- Wait a few minutes for DNS propagation — it can take up to 15 minutes
- If using Cloudflare, disable the proxy (orange cloud) during initial setup — use DNS Only (grey cloud)
- Verify your record with an external tool like
dig gtm.example.com
SSL Certificate Not Provisioning
Traefik uses HTTP-01 challenge to provision Let's Encrypt certificates. If SSL isn't working:
- Ensure port 80 and 443 are open on your server
- Make sure Cloudflare proxy is disabled (grey cloud) — Traefik needs direct access for the HTTP-01 challenge
- Check that the A record is correctly pointing to your server
- Restart the container from the management page — this triggers a new certificate request
Tags Not Firing
If your analytics tags aren't recording data:
- Verify your Container Config is correct — it should be a base64 string from Google GTM
- Check that you updated your website's GTM snippet to point to your custom domain
- Use Preview mode to debug — the Tag Assistant shows exactly what's firing and what's failing
- Verify the container is in "running" status on the management page
Preview Mode Not Working
- The preview server runs on an auto-generated
*.dublyo.cosubdomain — check the management page for the exact URL - Make sure the preview container is running (check container status)
- Verify that the
PREVIEW_SERVER_URLin the production container matches the preview domain - Try restarting both containers from the management page
Container Won't Start
- Check that your server has enough resources (at least 1.5 vCPU and 768 MB free RAM)
- Verify the Container Config is valid — an invalid config will cause the container to crash on startup
- Check Portainer logs on your server for detailed error messages
Frequently Asked Questions
How much does sGTM hosting cost on Dublyo?
You only pay for server credits — there are no per-request fees. A Starter server (2 vCPU, 4 GB) costs approximately 2 credits/hour. The sGTM deployment itself is free; you're just paying for the server resources it uses.
Can I run multiple GTM containers on one server?
Yes, as long as your server has enough resources and deployment capacity. Each GTM deployment uses approximately 1.5 vCPU and 768 MB RAM. A Standard server (4 vCPU, 8 GB) can comfortably run 2 GTM deployments alongside other apps.
Can I use a root domain (example.com) instead of a subdomain?
Yes, but using a subdomain like gtm.example.com is recommended. Root domains can have DNS limitations with some registrars, and using a subdomain keeps your main domain free for your website.
What server size do you recommend?
For production use, we recommend a Standard server (4 vCPU, 8 GB RAM) or higher. A Starter server works for testing or very low-traffic sites, but may struggle under moderate load.
Does the Custom Loader really bypass ad blockers?
Yes. Ad blockers typically block requests to known tracking domains like googletagmanager.com. When you serve gtm.js from your own domain via the Custom Loader, the browser sees a first-party request that ad blockers don't recognize or block.
Can I run other apps alongside sGTM?
Yes. GTM containers run alongside WordPress sites, template deployments, and other apps on the same server. Each deployment is isolated via Docker and Traefik routing. Just make sure your server has enough capacity.
How do I update my Container Config?
Currently, to update the Container Config you need to delete the existing GTM deployment and create a new one with the updated config. Your Custom Loader path and domain can be reused.
What's the difference between the Web container ID and the Server container?
You need both: the Server container provides the Container Config string used during deployment. The Web container ID (e.g., GTM-ABC123) goes in the snippet on your website. The Web container sends data to your server-side endpoint, and the Server container processes it.
Are power-ups free?
Yes. All power-ups (Cookie Keeper, User ID, Bot Detection, IP Blocklist) are free and open-source. There are no per-feature charges. Enable them from the management page with a toggle.
Do power-ups add latency?
The proxy adds minimal overhead (typically 1-3ms). It runs on the same server as your sGTM container, so there's no network round-trip. The power-ups are optimized: bot patterns are pre-compiled into a single regex, IP CIDRs are pre-parsed at startup, and cookies are rewritten in a streaming response modifier.
Need Help?
Can't find what you're looking for? Check the full documentation or reach out.