In this article, In this article, you will learn when to use Google Tag Manager (GTM) with Zenchef, how to connect it correctly, and how to map Zenchef events to your analytics and advertising tools while remaining GDPR-compliant.
Summary
Why & when to choose Google Tag Manager
Create & connect your GTM container (one‑time)
Data‑layer & trigger reference (v‑2025‑04)
Map events to your analytics & ad platforms
Test before going live
Handling cross‑domain & UTM loss
Consent & GDPR
Troubleshooting checklist
Advanced Q & A
Best‑practice recap
1. Why & when to choose Google Tag Manager
Use GTM when you need multi‑pixel setups, A/B tools, consent managers, server‑side tagging or any tracking change without a developer.
If you only need basic traffic stats, loading GA4 directly via the Zenchef field is enough.
Google Tag Manager can then become the single place where you load the different pixel setups and dispatch every event (standard or custom).
2. Create & connect your GTM container (one‑time)
| Step | Action | Why |
|---|---|---|
| 2.1 | In tagmanager.google.com → Create account (or Admin → + Create Container). Choose Web. | Mobile/App containers cannot receive Zenchef widget events. |
| 2.2 | Publish an empty container and note the ID GTM-XXXXXXX shown in the header. |
Only published containers receive live data. |
| 2.3 | In Zenchef Back‑Office → Settings → Partners → Audience measurement paste the GTM ID into Google Tag Manager code, then Save. | Zenchef injects the GTM script on all Zensite pages & widgets — no manual code. |
Multiple restaurants? Use the same GTM ID everywhere; the data layer always includes restaurant_id, so you can filter per venue later.
3. Data‑layer & trigger reference (v‑2025‑04)
Our Analytics implementation provide some custom metrics and dimensions. Read more about Metrics and dimensions
4. Map events to your analytics & ad platforms
-
GA4 — Create a GA4 Event tag for each trigger.
– Set Event Name = trigger name or map to Google’s recommended e‑commerce names (
zenchef.booking_created➜purchase).– Add Event parameters exactly as listed in §4 to expose them in reports.
Meta / TikTok / Pinterest — Use the same GTM trigger to fire their equivalent events (e.g. “Purchase”). One widget action = one hit across all tools.
5. Test before going live ⚙️
Click Preview in GTM, enter your Zensite URL, open the booking widget.
In Tag Assistant, switch to Data Layer: events in §4 should appear with the right keys.
Validate tags fire, then Submit → Publish. Data appears within seconds in GA4 Realtime.
6. Handling cross‑domain & UTM loss
The booking widget can open on a Zenchef domain, which drops your UTMs. Fix:
<script>
function getUTM(){const q=new URLSearchParams(location.search);
return ['utm_source','utm_medium','utm_campaign'].reduce((o,k)=>(q.get(k)?o[k]=q.get(k):0,o),{});
}
function patchLinks(){const u=getUTM();
document.querySelectorAll('a').forEach(a=>{if(Object.keys(u).length&&a.hostname!==location.hostname){const n=new URL(a.href);n.search ||= new URLSearchParams(u).toString();a.href=n;}});
}
window.addEventListener('load',patchLinks);
</script>
Add before GTM so every outbound link keeps the UTMs.
7. Consent & GDPR
Zenchef anonymises IPs but does not collect consent.
Deploy a CMP (e.g. Axeptio) via GTM before any analytics tag.
Fire GA4 only after a “Consent given” trigger or through
gtm.allowlist.
8. Troubleshooting checklist
| Issue | Likely cause | Fix |
|---|---|---|
| Events visible in GTM Preview but not GA4 | GA4 tag missing or wrong parameter names | Check GA4 tag, ensure parameters match §4 |
Duplicate booking_created events |
GA4 added both in Zenchef & GTM | Remove GA4 ID from Zenchef when GTM handles GA4 |
| Pixel counts bookings twice | Pixel also installed directly in site | Keep only the GTM implementation |
| No data after 24 h | Ad‑blockers or no consent | Test without blockers; verify CMP sends consent |
9. Advanced Q & A
Can I feed the same events to server‑side GTM? — Yes, map the data‑layer variables in your server container and forward hits.
How do I debug cross‑domain attribution in GA4? — GA4 Admin → Data Streams → Web stream → Configure Tagging Settings → Configure your domains (add your site &
booking.zenchef.com).Is Zenchef planning a native CMP? — For now, each restaurant is responsible for providing and managing its own data collection. We only supply the data to your website — it is your responsibility to handle user consent appropriately.
10. Best‑practice recap
Import the Zenchef template first — Saves hours of manual tagging.
Preview & Realtime validate after every change.
Review consent flows yearly to stay compliant.