Google Analytics 4 integration

Google Analytics 4 measures traffic, sources and key events on your site. Framer and Webflow both have a native field for the GA4 measurement ID, and on Next.js we use the GoogleAnalytics component from @next/third-parties. We set up Consent Mode v2 and the key events your team reports on, so the numbers hold up in the EU.

Updated

Official sources

  1. How to set up Google Analytics (opens in a new tab)Framer Help · framer.com
  2. Connect your site to Google Analytics (opens in a new tab)Webflow Help · help.webflow.com
  3. Third-party libraries (opens in a new tab)Next.js docs · nextjs.org
  4. @astrojs/partytown (opens in a new tab)Astro docs · docs.astro.build
  5. Set up consent mode (opens in a new tab)Google · developers.google.com
  6. EU user consent policy and Consent Mode (opens in a new tab)Google Analytics Help · support.google.com
  7. EU-focused data and privacy (opens in a new tab)Google Analytics Help · support.google.com

Checked against the official docs on. Tools change often; we re-check before every build.

Press Escape to close.

Google Analytics 4 integration at a glance
ComplexityLow
Method
  • Framer: Native
  • Webflow: Native
  • Astro: Embed
  • Next.js: Embed
Typical setup2 to 4 hours
What we doWe add GA4, set up Consent Mode v2 with your banner and define the key events your team reports on.
CategoryAnalytics

Setup by platform

How we set up Google Analytics 4

  • Framer

    • Native

    Paste the GA4 measurement ID into Framer’s site settings and publish. When the site also runs Google Tag Manager, we configure GA4 inside GTM instead and use Framer’s Cookie Banner for Consent Mode.

  • Webflow

    • Native

    Site settings, Integrations, Google Analytics: paste the GA4 measurement ID and publish. Webflow Ecommerce then sends product, cart and purchase events automatically. We never run this and the Google site tools app together.

  • Astro

    • Embed

    The Google tag goes in the shared layout, loaded after the consent defaults are set. On heavier pages we can move it off the main thread with the official @astrojs/partytown integration.

  • Next.js

    • Embed

    <GoogleAnalytics gaId="G-…" /> from @next/third-parties in the root layout (still labelled experimental by Next.js), with sendGAEvent for custom events. If GTM is on the site, GA4 lives in GTM instead.

Use cases

What teams use it for

  1. Traffic and acquisition

    Which channels, campaigns and landing pages bring visitors, by country and device.

  2. Key events

    Demo bookings, form submits and CTA clicks as key events, so marketing can see what converts.

  3. Ads audiences

    Conversions and audiences shared with Google Ads, with the EU consent signals Google requires.

Before you add it

What to watch out for

  • Consent and GDPR

    Consent Mode v2 in the EEA

    EEA users need four signals: ad_storage, analytics_storage, ad_user_data and ad_personalization. Without them they drop out of linked ad audiences.

  • Data layer

    Count each pageview once

    Use one install (native field, Google site tools app or GTM); two double every event. On Next.js, GA4’s history-based page changes cover client navigation.

  • Performance

    Load after the page

    The @next/third-parties component loads the tag after hydration. On Astro we keep the tag async or in Partytown so it never blocks the first paint.

FAQ

Questions about Google Analytics 4

Adrian

Can't find your answer?

Book a call and let's talk.

Or email us hello@designme.agency

Do we need custom code to add GA4 to Framer or Webflow?

No. Both have a native field for the GA4 measurement ID in site settings. Custom code only comes in when you add Google Tag Manager or other tags.

What happens to EU data if we skip Consent Mode v2?

Since March 2024, only users outside the EEA are included in audiences used by linked Google ads products, and ads measurement for EEA users is limited.

GA4 directly or through Google Tag Manager?

GA4 on its own is fine for a simple site. Once you add ad pixels or other tags, we move GA4 into GTM so every tag follows the same consent and triggers.

You've reached the end, so now…

Tell us what you’re building.

We’ll help you map the right scope, team, timeline, and next steps.

Book a call