Analytics and conversion tracking for Next.js

I set up tracking in your Next.js code, so the numbers in Meta and GA4 match what actually happened on your site.

I spent about 4 years on custom Next.js e-commerce sites, where Meta Pixel, Conversions API, dataLayer and GA4 were part of the job.

Tell me about your tracking

I reply within one business day. No obligation.

Signs your tracking is off

  • Meta reports more purchases than your store recorded, or a lot fewer.

  • GA4 shows one page view per visit, because page changes in Next.js aren't tracked.

  • Every purchase is counted twice: once from the browser and once from the server.

  • Your cookie banner shows up, but tags fire before anyone clicks Accept.

  • Event Match Quality in Meta Events Manager is low, so ads optimize on thin data.

Each of these has a specific cause in the code. That's the part I fix.

Do you need a developer for this?

Not always, and it's worth checking first.

In April 2026, Meta launched a free, one-click Conversions API in Events Manager. It mirrors the events your Pixel already sends, and deduplicates them automatically (PPC Land). For a simple site, that may be all you need. Standard Shopify stores are also well covered by the official apps.

You need work in the code when:

  • Your checkout or app is custom, so there's no plugin to install.

  • Events happen on the server, like subscription renewals, webhooks or orders confirmed later.

  • You need control over what goes to Meta, such as hashed customer data, or less data for EU privacy rules.

  • Consent mode must follow your own cookie banner, not a plugin's.

What I set up

  • A dataLayer with a documented event list, so marketing and developers use the same names.

  • GA4 events, including page views when users move between pages without a full reload.

  • Meta Pixel (formerly Facebook Pixel) in the browser and Conversions API from the server, sharing one event_id so Meta counts each event once.

  • Better match quality, by passing the fbp and fbc cookies and hashed customer data where you have consent.

  • Google Ads and TikTok conversions, from the same dataLayer, so every platform counts the same purchase the same way.

  • Google Consent Mode v2, connected to your consent banner.

  • Server-side Google Tag Manager, only if your setup needs it.

  • A test run of every event in GA4 DebugView and Meta's Test Events, written up for your team.

Who owns what

I own the code in your repo and the server endpoints that send events.

Your marketing team owns the ad accounts, campaigns and dashboards.

That split keeps things clear. When numbers look off, we can tell quickly whether it's the data or the campaign.

A note on server-side Tag Manager

Server-side GTM needs its own server. On Google Cloud, a production setup starts around $120 a month. Hosting services like Stape start around $20 a month (Stape). That's a monthly cost, and one more system to look after.

For many Next.js sites, sending server events from your own API routes does the same job at no extra cost. I'll tell you which one fits before you pay for anything.

Pricing

Tracking setup starts at $600. That covers GA4, Meta Pixel and Conversions API on one site, for the standard events: page views, product views, add to cart, checkout, purchase and leads. It includes the dataLayer, deduplication and a written test report, in about 1 week. Google Ads, TikTok, consent mode and server-side GTM are quoted on top, based on your setup.

  • Fixes to an existing setup are billed at $25 an hour.

  • Process and payment terms work like my other development projects. See how I work.

Where this comes from

  • About 4 years on custom Next.js e-commerce sites. Pixel, Conversions API, dataLayer and GA4 ran on real stores with real ad spend.
  • Building headless storefronts where no plugin existed, so tracking had to be written in code. Headless CMS
faq

Questions about tracking

Yes, in most cases. Meta recommends running both, with a shared event ID so each event counts once. The Pixel catches browser signals, and the server catches what the browser misses.

For a simple site, it may be. It sends the same events and data your Pixel already captures. It doesn't let you choose events or parameters, or send events that only happen on the server.

Send the same event_id with the browser event and the server event. Meta then keeps one and drops the other. Most double counting I see comes from a missing or mismatched ID.

From June 15, 2026, Google Ads data from the Analytics tag follows only the ad_storage consent signal. Google Analytics features follow only the Google Signals setting (Cookiebot). If your banner doesn't set ad_storage correctly, ads data can go missing.

Yes. Google Ads conversions and the TikTok Pixel, built on the same dataLayer and event list as GA4 and Meta. That way every platform reports the same purchase the same way.

About 1 week for the standard events on one site. Consent mode, server-side GTM or extra ad platforms add a few days.

Only custom or headless storefronts built with Next.js. For a standard Shopify store, the official integrations are usually the better deal.

Tell me about your tracking

Tell me what you track today, which ad platforms you use, and what looks wrong.

Tell me about your tracking

I reply within one business day. No obligation.

Contact

Get in Touch

Other ways to reach me

I'm available via email and messaging platforms.

Chat with me

Quick questions or follow-ups

Contact Us

Munim Rahman

Fullstack Developer • Next.js & Nest.js

Dhaka, Bangladesh

I usually reply within 24 hours.