Integrations · Analytics

Google Analytics on Next.js, Webflow, Framer and Astro

Google Analytics 4 tells you where visitors come from and what they do. For Next.js Google Analytics, and GA4 on Webflow, Framer and Astro, we set it up so the numbers hold up and nothing fires before consent.

Next.js

Next.js Google Analytics, step by step

In Next.js, load GA4 through the GoogleTagManager component in the root layout and set consent defaults before the container loads, or page views go uncounted or double.

  1. 01

    Create the property and the container

    A GA4 property and a Google Tag Manager container for the site.

  2. 02

    Store the ID on the host

    Put the container ID in an environment variable on your host, for production and preview builds.

  3. 03

    Add GoogleTagManager to the root layout

    Load the container with the GoogleTagManager component from @next/third-parties in the root layout.

  4. 04

    Set consent defaults first

    An inline Consent Mode v2 default runs before the container, and your cookie banner updates it.

  5. 05

    Configure GA4 and verify

    Set up GA4 and key events inside the container, then check them in GA4’s DebugView before launch.

Use cases

What teams use it for

01

Conversion reporting

Demo requests, sign-ups and trial starts tracked as key events, so you see which channels produce them.

02

Content performance

Which blog posts, docs and landing pages bring people in, and which lead to the next step.

03

Campaign checks

UTM-tagged ads and emails compared on engaged sessions and conversions, not just clicks.

Cautions

Common Google Analytics pitfalls

Two installs at once, such as Webflow’s built-in GA4 field plus a GA4 tag in Google Tag Manager, count every page view twice.

Data

A container ID missing from the host’s environment variables means production ships without analytics, and nobody notices for days.

Data

GA4 sets cookies and sends data to Google. In the EU it needs consent; Consent Mode v2 passes the choice to Google and limits what is sent.

Privacy

Expect gaps: visitors who decline consent, ad blockers and modeled data mean GA4 numbers will not match your CRM one to one.

Data

Each extra tag in the container adds script weight. We keep the container lean and audit it before launch.

Performance
Handover

What we set up and hand over

Analytics is the baseline of our SEO & AEO work, from $3,000 a month.

What we set up
GA4 via Google Tag Manager, Consent Mode v2, key events, Search Console link
Typical time
1–2 days
Complexity
Medium
FAQ

Questions about Google Analytics

Do I need Google Tag Manager for GA4 in Next.js?
Not strictly, but we recommend it. GTM handles Consent Mode v2, keeps all tags in one place and lets marketing add events later without a deploy.
What is @next/third-parties?
It is Next.js’s package of components for popular third-party scripts, including GoogleTagManager and GoogleAnalytics for Google tags.
Why does GA4 count page views twice?
Usually because it is installed twice, such as Webflow’s built-in GA4 field and a GA4 tag in Google Tag Manager. We keep one install.
How do I add Google Analytics to Webflow?
Paste the Google Tag Manager snippets into Webflow’s head and body custom code and configure GA4 in the container. Webflow also has a built-in GA4 field; we use GTM so consent is handled in one place.
Is Google Analytics GDPR compliant?
It can be used lawfully in the EU with a consent banner, Consent Mode v2, data retention settings and a processing agreement with Google. Whether it fits your risk appetite is a decision for you and your privacy adviser.
What events do you set up?
Usually form submissions, demo bookings, sign-up clicks, pricing page views and outbound clicks to your app. We agree the list with you first, so the reports answer real questions.
Thomas OldenburgerFounder, design and build lead

Still deciding? A 30-minute call answers most of it.

Got a brief, or half of one?

Book a free 30-minute call. You leave with a straight answer on scope, price and timing, even when we are not the right fit.