What is the best way to transfer Google Tag Manager (GTM) codes and pixel from an existing WordPress site to a new Webflow (WF) site with 301 redirects and a cleaner URL structure? Should I create a new container in GTM for the WF site and build all tags from scratch, or can I copy the master GTM tags and paste them in the new WF site, continuing as normal?

TL;DR
  • Reuse your existing GTM container by embedding its code in Webflow's Project Settings under Custom Code.  
  • Update GTM tag triggers to match Webflow's structure, implement 301 redirects in Hosting settings, and test with GTM Preview and Tag Assistant tools.

To move Google Tag Manager (GTM) and existing pixels from a WordPress site to a Webflow site — along with 301 redirects and a cleaner URL structure — you don’t need a new GTM container. You can reuse the existing container with adjustments.

1. Reuse Your Existing GTM Container

  • Do not create a new GTM container unless there’s a specific reason (e.g., separating analytics/data ownership by domain).
  • Copy the GTM embed code (both <head> and <body> parts) from WordPress and place it in Webflow:
  • Go to Webflow Project Settings → Custom Code.
  • Paste the GTM head snippet inside the Head Code section.
  • Paste the GTM body snippet inside the Before </body> tag section.

2. Review and Update Tag Triggers in GTM

  • Webflow has different page structure and DOM events than WordPress. So:
  • Revisit any DOM-based triggers, form submissions, or click events.
  • Ensure all Triggers in your GTM container align with the new Webflow page structure.
  • For Google AnalyticsFacebook Pixel, etc., tags can remain as-is — but verify they are firing correctly using Preview Mode in GTM or Tag Assistant.

3. Implement 301 Redirects in Webflow

  • Webflow allows 301 redirects via the Hosting → 301 Redirects tab.
  • Manually map old WordPress URLs to new clean Webflow URLs.
  • Example: /old-blog-post → /blog/post-title.
  • This preserves SEO value and ensures pixel events still match expected URLs.

4. Validate Data Layer Compatibility (Optional)

  • If your WordPress setup had custom dataLayer pushes, those may not exist in Webflow.
  • Webflow doesn’t expose dataLayer by default. You may need to:
  • Recreate them via Webflow’s Custom Code blocks in the page or site-wide.
  • Or adjust GTM Tags/Triggers to not rely on missing values.

5. Use Preview and Debugging Tools

  • Test everything using GTM Preview Mode.
  • Use Google Tag Assistant or Facebook Pixel Helper browser extensions to confirm correct firing and events.

Summary

Reuse your existing GTM container, embed it in Webflow via Project Settings → Custom Code, and review your tag triggers for compatibility. 301 redirects can be added in Webflow’s Hosting settings to maintain SEO and tracking continuity.

Rate this answer

Other Webflow Questions