In this guide
- Drupal's Google Tag module adds a Tag Manager container. You add a data layer for the events you need.
- For Drupal Commerce, use a module or custom code to push purchase events.
- Watch caching and forms, then send events to a server container.
Drupal powers many publishers, public bodies and mid-size sites, and its flexibility means tracking is usually a mix of a module and some custom code. Server-side tagging fits well, because it keeps the page light and puts the logic in one place. This page covers the route and the Drupal-specific traps. Module names and versions change, so follow the documentation of the modules you use. See how server-side tracking works and Google Tag Manager best practices.
Add the container
The Google Tag module adds a Tag Manager container to your site and lets you control where it loads, for example not on admin pages. Set your container ID, then point the Google tag in the container to your tagging subdomain.
Runs on your domain, anywhere
Your tracking runs on your own domain, so a visit from any country is handled the same way.
Push events to the data layer
| Event | Where in Drupal | How |
|---|---|---|
| Page view | Every page | The container does it |
| Form submit (lead) | Webform or contact form confirmation | A small behaviour or the confirmation page pushes generate_lead |
| Newsletter sign-up | The subscription form | Push sign_up after success |
| Purchase | Drupal Commerce checkout completion | A module or an event subscriber pushes purchase with the order data |
| Search | The search results page | Push search with the term |
Caching
Drupal's page cache and CDN can serve stored pages. If the data layer values are rendered into the page, they may be stale or shared between visitors. Use JavaScript to push events on interaction, and keep user-specific values out of cached HTML. Test as an anonymous and a logged-in user.
Check your tracking in one pass
This is an example. Run the check on your own site to see where yours stands.
Forms
- Fire the lead event on the confirmation, not on button click.
- Do not send form values to analytics. Send the form name only. See data loss prevention.
- Use a lead ID and capture click IDs in hidden fields so you can send offline conversions. See offline conversions.
Consent
Use a consent module or an external consent platform and connect it to Tag Manager with Consent Mode. Tags and server tags should respect it. See consent banners.
Server-side set-up
Add the server container and the platform tags, as in the setup guide. With Open Tracked hosting the container, subdomain and power-ups run for you, and Cookie Keeper, Data Store, Enricher and Bot Detection are on every plan.
Test
- Open Preview and visit the site as an anonymous visitor.
- Submit a test form and a test order.
- Check the data layer and server Preview.
- Check the platform test tools.
- Repeat after clearing the Drupal cache.
A realistic example
A regional news site runs on Drupal and wants to understand which newsletter sign-up positions work, and to send sign-ups to its ad platforms for audience building. It adds the Google Tag module, pushes a sign_up event with the form position from the confirmation message, and points the container at a server container. The first test shows that the data layer is empty for logged-out visitors because the page cache serves a stored copy. The developer switches to a JavaScript push on form success, which works regardless of the cache. A week of data shows that the in-article box produces three times the sign-ups of the footer form, and the team moves it higher on the page. The cache issue was the main surprise, and it is the first thing to check on any Drupal site.
Watch events arrive, live
A sample feed. In Open Tracked you see the same stream for your own store.
Frequently asked questions
How do I add Google Tag Manager to Drupal?
With the Google Tag module, then set your container ID.
How do I track Drupal Commerce purchases?
Push a purchase event with the order data when checkout completes.
Does Drupal caching affect tracking?
It can. Push events with JavaScript and keep user-specific values out of cached pages.
Can I use a server container with Drupal?
Yes. Point the Google tag to your tagging subdomain.
How do I track form submissions?
Push an event on the confirmation, with the form name and a lead ID, not the values.
Do I need spreadsheets to read my results?
No. Once tracking is live, the Open Tracked analytics shows spend, revenue, ROAS and profit, and you can ask Ari, the built-in AI assistant, questions about your own numbers in plain words. Ari's allowance depends on your analytics plan.
Is Open Tracked different from Open Track or Open Space Track?
No. Open Tracked is the official name of our server-side tracking platform, and the website is opentracked.io. Many people search for it as Open Track, OpenTrack or Open Space Track. All of them lead to the same product: server-side Google Tag Manager hosting, first-party analytics and a CRM pipeline.

Fix your tracking at the source
Open Tracked hosts your server-side Tag Manager, keeps first-party cookies alive and shows what each ad is really worth.
The Open Tracked team
We build Open Tracked: server-side tracking hosting, analytics and the tools around them, for stores that spend on ads. Questions about this guide, or an idea for the next one?
Comments
Loading comments...
