hugo-universal-theme
hugo-universal-theme copied to clipboard
Add config-driven GTM, Meta Pixel, and Facebook verification
Summary
Adds optional, config-driven support for three common tracking/verification tools:
- Google Tag Manager (
gtm_id) — head script + body noscript fallback - Meta/Facebook Pixel (
meta_pixel_id) — tracking pixel with noscript fallback - Facebook Domain Verification (
facebook_domain_verification) — meta tag
All are opt-in: if the param is not set, nothing is rendered.
Configuration
Add any combination to config.toml / hugo.toml:
[params]
facebook_domain_verification = "your-verification-code"
meta_pixel_id = "your-meta-pixel-id"
gtm_id = "GTM-XXXXXXX"
Files changed
- 4 new partials:
facebook-verification.html,gtm-head.html,gtm-body.html,meta-pixel-head.html headers.html: includes head-level partials- All 5 layout files (
index,single,list,page/single,404): GTM body noscript after<body> exampleSite/hugo.toml: commented-out example config
Test plan
- [ ] Run example site without params — verify no tracking code in output
- [x] Add
gtm_idand verify GTM script in<head>and noscript after<body> - [x] Add
meta_pixel_idand verify pixel code in<head> - [x] Add
facebook_domain_verificationand verify meta tag in<head>