tagdock

Run server-side Google Tag Manager on your own server with Docker Compose.

BashMITv0.1.0GitHub

tagdock runs server-side Google Tag Manager on your own Linux server, as an alternative to paid sGTM hosting. It follows Google's manual setup guide for running the tagging server outside Google Cloud and wraps it in one script.

I built it after running sGTM for several sites and repeating the same steps every time.

Features

  • A preview server and a tagging server for every GTM server container, as Google describes
  • HTTPS with Let's Encrypt through Caddy, or your own nginx in front
  • Several containers on one server, for example one per client
  • A DNS check that warns when a domain does not point to the server yet
  • heal restarts tagging servers that got stuck, update pulls the latest image

Get started

You need a Linux server with Docker and the Compose plugin, ports 80 and 443, and two DNS records per container, for example sgtm.example.com and sgtm-preview.example.com.

git clone https://github.com/VincentBorgers/tagdock.git
cd tagdock
cp tagdock.env.example tagdock.env
./tagdock add shop
./tagdock up

The full documentation is in the README.

Questions

Is tagdock free?

Yes. tagdock is open source under the MIT license. You only pay for the server you run it on.

Does tagdock contain Google code?

No. It pulls the tagging server image from Google's registry. Running that image is subject to the Google Tag Manager terms of service.

Can I use it behind my existing nginx?

Yes. With PROXY=none the containers listen on local ports and your own reverse proxy handles HTTPS.

Related posts