What is Docker?
Docker packs an application with its runtime, libraries and settings into a container. The container behaves the same on every server, whether on a developer’s computer, at a German hosting provider or in the cloud. That is exactly what makes Docker interesting for running a server container: Google supplies the application ready-packed, and you only decide where it runs. Three terms are enough to understand it:
- Image: the read-only template. For server-side tracking, Google provides a ready-made image.
- Container: a running instance of an image. Any number of identical containers can be started from one image, for example several tagging servers.
- Registry: a store for images. Docker Hub is the public registry; Google’s image is held in Google’s own registry.
Containers are leaner than virtual machines because they do not need their own operating system kernel but use the kernel of the server. That is why several containers fit on one small server.
Docker in server-side tracking: how it works
In server-side tracking with Google Tag Manager, the server container always runs as a container built from a Docker image. The only question is who runs it. With Google Cloud Run or a specialised host, the provider takes care of it. On your own server you set it up yourself, as described in Google’s manual setup guide:
- Image:
gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable - One preview server: exactly one, with
CONTAINER_CONFIGandRUN_AS_PREVIEW_SERVER=true. Tag Manager’s preview mode runs through it. - Several tagging servers: with
CONTAINER_CONFIGand the preview server’s address inPREVIEW_SERVER_URL. Google recommends running them as a cluster, with at most one virtual CPU per server. - Reachability: in Google’s examples the server listens on port 8080, which the
PORTsetting can change. Under/healthyit reports whether it is running. In front of it you need a web server or load balancer with a certificate for your domain.
Advantages of your own Docker server
- Data protection and control: you decide where the server is located and who runs it, for example a hosting provider in Germany without a US parent company, or your own data centre. For the server itself, the question of transfers to a third country then does not arise, and you set logging, access and retention yourself. That is why companies with strict data protection requirements in particular choose this route.
- Costs: a small cloud server at a German hosting provider costs a few euros to just over ten euros a month. Two tagging servers and one preview server therefore come to around 20 to 30 euros. For Google Cloud Run, Google quotes around 45 US dollars per server and recommends at least two, so around 90 US dollars a month.
- Close to the website: if the container runs on the same server or behind the same proxy as the website, it is in the same network. Safari then keeps cookies set by the server for longer than the seven days to which it limits cookies from other networks.
- Independence: no Google Cloud billing account and no billing per request as with specialised hosts.
One limitation belongs here: whatever the server forwards to GA4, Google Ads or Meta still ends up with those providers. And you need consent with your own server just as much as without it.
Disadvantages: you take over operations
- Maintenance: Google keeps developing the image. Someone has to apply updates to the image, the operating system and the certificates; with Cloud Run or a host this happens without you.
- Resilience and load: Cloud Run starts additional servers itself when traffic is high. On your own servers you plan reserves, load balancing and replacement in case of failure yourself. If the server fails, the data for that period is missing.
- Monitoring: someone has to notice when the server does not respond or data does not arrive, ideally before it shows up in a report.
- Setup details: if a proxy sits in front of the container, it has to pass on the visitors’ IP address. Otherwise the server only sees the proxy’s address, and Analytics assigns all visits to the server’s location. This does happen in practice, which is why we check it at every acceptance test.
- Know-how: without someone who knows Linux, Docker and web servers, the server costs you save are quickly eaten up by working time.
Matomo and Piwik PRO in server-side tracking
Those who care about data protection often choose Matomo or Piwik PRO for web analytics instead of Google Analytics. Both come with their own tag manager, but it works in the browser. Matomo Tag Manager cannot do server-side tagging at present, as Matomo itself confirms. For server-side tracking, both providers therefore describe the route via a Google Tag Manager server container:
- Matomo: Matomo can be self-hosted with the official Docker image, together with a MySQL or MariaDB database. For the server container, Matomo provides its own client template; the tracking code then points to your server address. Alternatively, your server sends the data directly to Matomo via the tracking API.
- Piwik PRO: for the server container, Piwik PRO provides a client and a tag template; the tracking code points to your server container. Piwik PRO itself recommends combining the server container with its own tag manager. Piwik PRO also names JENTIS and, on the Enterprise plan, its own data collector on your domain, which covers analytics only.
This makes a setup entirely on your own servers possible: Matomo and Google’s server container both run as Docker containers, for example at a hosting provider in Germany. The server container then supplies advertising platforms such as Google Ads or Meta only with the data you approve.
Your own Docker server, Cloud Run or a host?
| Comparison | Own Docker server | Google Cloud Run | Specialised host |
|---|---|---|---|
| Cost per month | a few euros per server, plus working time for operations | around 45 US dollars per server, at least two recommended | depending on requests, from around 20 US dollars |
| Location and provider | freely selectable, including in Germany | Google region selectable, provider Google | depending on the host’s offer |
| Maintenance and updates | down to you or your service provider | handled by Google | handled by the host |
| Traffic peaks | plan them yourself | automatic | automatic within the plan |
| Suits you if | data protection requirements are strict and IT is available | you already use Google Cloud | you want to start quickly |
We discuss which route fits with you and your IT. The costs of the three routes in detail are on our server-side tracking page.
What else Docker is used for
Outside tracking, Docker is mainly used for development and test environments that behave like the live server, and for running applications in the cloud. Many cloud services, including Google Cloud Run, run applications as containers. The desktop application Docker Desktop is free, among others, for small businesses with fewer than 250 employees and less than 10 million US dollars in annual revenue. Companies that reach either limit, and government entities, need a subscription. Docker Engine on the server is open source.
Do you want to run server-side tracking on your own server or find out which route suits you? Then get in touch with us or read more about our server-side tracking!
