What is Stape and why use it?
Stape is a managed hosting platform for server-side Google Tag Manager. Instead of provisioning and managing your own Google Cloud Run instance, Stape manages the infrastructure for you. You create an account, configure your container and are live in a few minutes.
The cost is typically 15 to 30 dollars per month for a site with normal traffic, comparable to or lower than running Google Cloud Run directly once you count the time spent on infrastructure management.
Step by step: server-side GTM with Stape
Step 1: Create a GTM server container. In Google Tag Manager you create a new container of the type Server. Copy the container config string.
Step 2: Create a Stape account. Register at stape.io and create a new container. Paste in your GTM container config string. Stape provisions a tagging server URL.
Step 3: Configure a custom subdomain. Add a CNAME record in your DNS that points to Stape's servers, for example metrics.yoursite.com. That makes tracking calls go through your own domain, where they are treated as first-party data.
Step 4: Update the web container. In your regular GTM web container you update the transport URL of the GA4 tag to your custom subdomain.
Subdomain vs same-origin setup
A custom subdomain is the standard setup and is enough for most. A same-origin setup, where tracking calls are proxied through a path on your main domain, gives further benefits for Safari ITP but requires a reverse proxy through a Cloudflare Worker or nginx. Stape recommends starting with a subdomain and upgrading to same-origin if your traffic is Safari heavy.
Stape's power-ups
Cookie Keeper extends cookie lifetime in Safari. Own CDN enables true first-party cookies. Custom Loader hides the origin of the GTM script from ad blockers. These power-ups are optional add-ons.
What server-side GTM with Stape solves
- Ad blockers that block client-side tracking
- Safari ITP, which limits JavaScript cookies to 7 days
- Better control over which data is sent to third-party providers
- Improved page speed when heavy tracking scripts run server-side
- Meta CAPI and other server-to-server integrations
Frequently asked questions
How much does Stape cost?
Typically 15 to 30 dollars per month for a site with normal traffic.
Subdomain or same-origin?
A custom subdomain is the standard and enough for most. Same-origin gives further benefits for Safari ITP but needs a reverse proxy, so Stape recommends starting with a subdomain.
Do I need to run Google Cloud myself?
No. Stape manages the infrastructure instead of you provisioning and managing your own Google Cloud Run instance.