Framer has become a popular choice for designers and marketers building high-converting websites without code. But a beautiful website means nothing if you cannot track what visitors do.
Google Tag Manager gives you the flexibility to add analytics, conversion tracking, and marketing pixels without touching code every time. Integrating GTM with Framer unlocks proper tracking for your campaigns.
This guide walks through the complete setup process, from basic installation to advanced event tracking.
Why Use Google Tag Manager with Framer
Framer has built-in analytics options, but they have limitations. Google Tag Manager provides:
Flexibility
Add Google Ads, GA4, Meta Pixel, LinkedIn, TikTok, and any other tracking platform through a single container. No need to add each script separately.
Control
Modify tracking without republishing your Framer site. Change triggers, add events, and fix issues directly in GTM.
Advanced Tracking
Track button clicks, form submissions, scroll depth, video engagement, and custom events. Built-in Framer analytics cannot match this depth.
Future-Proofing
When you add new marketing platforms, just add a tag in GTM. Your Framer site stays clean.
Prerequisites
Before starting, ensure you have:
- A Framer account with a published site (or ready to publish)
- A Google Tag Manager account
- Your GTM container ID (format: GTM-XXXXXXX)
If you do not have a GTM container yet:
- Go to tagmanager.google.com
- Create an account
- Create a container for “Web”
- Copy your container ID
Method 1: Adding GTM via Framer’s Custom Code Settings
This is the recommended method for most users.
Step 1: Access Site Settings
- Open your Framer project
- Click the gear icon to open Site Settings
- Navigate to the “General” section
- Find “Custom Code”
Step 2: Add the GTM Head Code
In the “Start of tag” section, paste the first part of the GTM snippet:
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->
Replace GTM-XXXXXXX with your actual container ID.
Step 3: Add the GTM Body Code
In the “Start of tag” section, paste the noscript fallback:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
Again, replace GTM-XXXXXXX with your container ID.
Step 4: Publish Your Site
Save the settings and publish your Framer site. GTM is now installed.
Step 5: Verify Installation
- Open GTM and click “Preview”
- Enter your Framer site URL
- The Tag Assistant should connect
- You should see “Container Found” confirmation
Method 2: Adding GTM via Code Component
If you need more control or want to conditionally load GTM, use a code component.
Step 1: Create a Code Component
- In Framer, go to Assets → Code
- Click “New” to create a new code component
- Name it “GTM” or “Google Tag Manager”
Step 2: Add the GTM Code
Replace the default code with:
import { useEffect } from "react"
export default function GTM() {
useEffect(() => {
// Initialize dataLayer
window.dataLayer = window.dataLayer || []
// GTM Script
const script = document.createElement("script")
script.innerHTML = `
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');
`
document.head.appendChild(script)
// GTM noscript iframe
const noscript = document.createElement("noscript")
const iframe = document.createElement("iframe")
iframe.src = "https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
iframe.height = "0"
iframe.width = "0"
iframe.style.display = "none"
iframe.style.visibility = "hidden"
noscript.appendChild(iframe)
document.body.insertBefore(noscript, document.body.firstChild)
}, [])
return null
}
Replace GTM-XXXXXXX with your container ID in both places.
Step 3: Place the Component
Drag the GTM component onto your page. Place it anywhere - it renders nothing visible.
For site-wide tracking, add it to a component that appears on every page, like a header or footer.
Setting Up Basic Page View Tracking
With GTM installed, set up GA4 page view tracking.
Step 1: Create a GA4 Configuration Tag
- In GTM, go to Tags → New
- Name it “GA4 - Configuration”
- Select “Google Analytics: GA4 Configuration”
- Enter your GA4 Measurement ID (format: G-XXXXXXXXXX)
- Set trigger to “All Pages”
- Save
Step 2: Handle Framer’s Single-Page Architecture
Framer sites often use client-side navigation, meaning traditional page views may not fire on every navigation.
Create a History Change trigger:
- Go to Triggers → New
- Name it “History Change”
- Select “History Change” as trigger type
- Save
Add this trigger to your GA4 Configuration tag to capture route changes.
Step 3: Test Page Views
- Open GTM Preview Mode
- Navigate your Framer site
- Confirm GA4 Configuration fires on initial load
- Click internal links and confirm History Change events fire
Tracking Button Clicks
Framer makes it easy to create buttons, but tracking clicks requires GTM configuration.
Step 1: Enable Click Variables
- In GTM, go to Variables → Configure
- Enable all Click variables:
- Click Element
- Click Classes
- Click ID
- Click Target
- Click URL
- Click Text
Step 2: Create a Click Trigger
- Go to Triggers → New
- Name it “Button Click - CTA”
- Select “Click - All Elements”
- Choose “Some Clicks”
- Set conditions based on how you identify the button:
- Click Text contains “Get Started”
- Click Classes contains “cta-button”
- Click URL contains “/signup”
Step 3: Create the Event Tag
- Go to Tags → New
- Name it “GA4 Event - CTA Click”
- Select “Google Analytics: GA4 Event”
- Configuration Tag: Select your GA4 Configuration
- Event Name: “cta_click”
- Add parameters as needed (button_text, page_path)
- Set trigger to your button click trigger
- Save
Step 4: Add Identifiable Classes in Framer
To make buttons easier to target:
- Select the button in Framer
- Open the properties panel
- Scroll to “HTML” or “Code” section
- Add a custom class name (e.g., “track-cta”)
Now your GTM trigger can target Click Classes contains track-cta.
Tracking Form Submissions
Framer forms require specific handling for submission tracking.
Method 1: Native Framer Forms
If using Framer’s built-in form component:
- Framer forms submit via AJAX
- The page does not reload
- Track the submit button click instead
Create a trigger:
- Trigger Type: Click - All Elements
- Condition: Click Element matches CSS selector
form button[type="submit"]
Or track form submission success by monitoring DOM changes after submission.
Method 2: Third-Party Form Embeds
If embedding Typeform, Tally, HubSpot, or similar:
Most embed forms support their own conversion tracking. Configure tracking within the form platform and use their GTM integrations.
For basic submission tracking:
- Many forms redirect to a thank-you page after submission
- Create a Page View trigger for the thank-you URL
- Fire your conversion tag on that trigger
Method 3: Custom Form Handling with Data Layer
For advanced tracking, push events to the data layer on form submission:
Create a code component that wraps your form logic:
import { useEffect } from "react"
export default function FormTracker() {
useEffect(() => {
const form = document.querySelector("form")
if (form) {
form.addEventListener("submit", function(e) {
window.dataLayer = window.dataLayer || []
window.dataLayer.push({
event: "form_submit",
form_name: "contact_form",
form_location: window.location.pathname
})
})
}
}, [])
return null
}
In GTM, create a Custom Event trigger for “form_submit”.
Tracking Scroll Depth
Monitor how far users scroll on your Framer pages.
Step 1: Enable Scroll Depth Variables
- In GTM, go to Variables → Configure
- Enable:
- Scroll Depth Threshold
- Scroll Depth Units
- Scroll Direction
Step 2: Create Scroll Depth Trigger
- Go to Triggers → New
- Name it “Scroll Depth - 50%”
- Select “Scroll Depth”
- Choose “Vertical Scroll Depths”
- Select “Percentages” and enter: 25, 50, 75, 90
- Save
Step 3: Create the Event Tag
- Go to Tags → New
- Name it “GA4 Event - Scroll Depth”
- Event Name: “scroll”
- Parameters:
- percent_scrolled: {{Scroll Depth Threshold}}
- page_path: {{Page Path}}
- Set trigger to your Scroll Depth trigger
- Save
Setting Up Google Ads Conversion Tracking
Track conversions from your Google Ads campaigns.
Step 1: Create the Conversion in Google Ads
- In Google Ads, go to Goals → Conversions → Summary
- Click “New conversion action”
- Select “Website”
- Choose “Manual” setup
- Configure your conversion settings
- Copy the Conversion ID and Conversion Label
Step 2: Create the Conversion Tag in GTM
- In GTM, go to Tags → New
- Name it “Google Ads - Lead Conversion”
- Select “Google Ads Conversion Tracking”
- Enter Conversion ID and Conversion Label
- Set trigger to your form submission or thank-you page trigger
- Save
Step 3: Add Conversion Linker
Ensure accurate attribution:
- Go to Tags → New
- Name it “Conversion Linker”
- Select “Conversion Linker”
- Set trigger to “All Pages”
- Save
This tag ensures click IDs persist across page navigations.
Implementing the Data Layer in Framer
For advanced tracking, implement a data layer that populates on each page.
Create a Data Layer Component
import { useEffect } from "react"
export default function DataLayer({ pageType, pageName }) {
useEffect(() => {
window.dataLayer = window.dataLayer || []
window.dataLayer.push({
event: "page_data",
page_type: pageType || "general",
page_name: pageName || document.title,
page_path: window.location.pathname
})
}, [pageType, pageName])
return null
}
Add this component to each page template, passing relevant properties:
- Homepage:
pageType="home" - Service pages:
pageType="service" - Blog posts:
pageType="blog"
Use Data Layer Variables in GTM
- Create Data Layer Variables for
page_typeandpage_name - Use these variables in your tag configurations
- Segment analytics by page type
Tracking Framer CMS Collections
If using Framer’s CMS for blog posts or dynamic content:
Track Content Views
Push content metadata to the data layer:
import { useEffect } from "react"
export default function ContentTracker({ title, category, author, publishDate }) {
useEffect(() => {
window.dataLayer = window.dataLayer || []
window.dataLayer.push({
event: "content_view",
content_title: title,
content_category: category,
content_author: author,
publish_date: publishDate
})
}, [title, category, author, publishDate])
return null
}
Create Content-Specific Audiences
Use this data to build audiences:
- Users who read blog posts in specific categories
- Users who engaged with multiple content pieces
- Users who viewed premium content
Common Issues and Fixes
GTM Not Firing on Route Changes
Framer uses client-side navigation. Add History Change triggers to capture navigation events.
Click Tracking Not Working
Framer components may have overlay elements. Use CSS Selector matching or check the actual click target in Preview Mode.
Forms Not Tracking
AJAX form submissions do not reload the page. Track button clicks or implement data layer events on submission callbacks.
Duplicate Page Views
If using both Page View and History Change triggers, you may double-count. Use either a single combined trigger or exclude initial page load from History Change.
Preview Mode Not Connecting
Framer’s published URL may differ from preview. Test on the actual published site URL.
Testing Checklist
Before going live, verify:
- GTM container loads on all pages
- GA4 page views fire correctly
- Button clicks track with correct parameters
- Form submissions fire conversion events
- Google Ads conversion tag fires on conversion pages
- Route changes trigger appropriate events
- No duplicate events fire
- All tags fire in correct order
Use GTM Preview Mode and GA4 DebugView to confirm data flows correctly.
Key Takeaway
Integrating Google Tag Manager with Framer unlocks proper tracking for your marketing campaigns. The setup requires attention to Framer’s single-page architecture and component-based structure.
Install GTM via Site Settings for simplicity, or use code components for more control. Handle client-side navigation with History Change triggers. Track buttons, forms, and scrolling to understand user behavior.
With GTM properly integrated, your Framer site transforms from a beautiful design into a measurable marketing asset.
Related Posts
How to Set Up Call Tracking with Google Ads and Google Tag Manager
12 min read
Why Your Booking Software Must Work with Google Tag Manager: A Guide to Long-Term Marketing Success
12 min read
How to Audit an Existing Google Tag Manager Setup
8 min read
Need Help With Your Google Ads?
I help e-commerce brands scale profitably with data-driven PPC strategies.
Get In Touch