hugo-universal-theme icon indicating copy to clipboard operation
hugo-universal-theme copied to clipboard

Add config-driven GTM, Meta Pixel, and Facebook verification

Open vittorio88 opened this issue 8 months ago • 0 comments

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_id and verify GTM script in <head> and noscript after <body>
  • [x] Add meta_pixel_id and verify pixel code in <head>
  • [x] Add facebook_domain_verification and verify meta tag in <head>

vittorio88 avatar Mar 15 '26 05:03 vittorio88