GA4 and Tag Manager Setup: Events, Consent, Server
What a correct GA4 and Tag Manager setup involves: event design, consent mode, server-side events and the limits Google documents.
- Organisation
- WavX Solutions
- Telephone
- +919310079927
Description
Integration Google Analytics 4 and Tag Manager setup: events, consent and server-side tracking
A GA4 setup is an event plan first and a tag second: decide which actions matter, send each one once with the parameters Google expects, respect the visitor's consent choice, and add server-side events for anything the browser cannot be trusted to report. WavX builds that plan into a site, store or app. This guide is written from Google's documentation as read on 2 October 2026.
Discuss an integration Last updated 2 October 2026
What the setup connects
Google Analytics 4 (GA4) records what visitors do as a stream of events. Google Tag Manager (GTM) is the container that decides which tags fire, when, and with what data. A setup connects three things to GA4: the pages of your site or store, the visitor's consent choice, and your own server, which knows facts the browser does not, such as whether a payment really went through.
The earlier WavX post on how to track your website analytics covers which numbers to watch. This page covers how the data gets there.
Browser Your server Google
------- ----------- ------
page + dataLayer events ----> (optional) server container -> GA4 property
consent banner choice ----> consent state on every hit
order paid / refunded ------> Measurement Protocol
GA4 -> BigQuery export
Data that flows each way
Event or object
Direction
What your system does with it
Page and interaction events ( page_view , view_item , add_to_cart )
Browser to GA4, through the Google tag or GTM
Pushes each action to the data layer once, with item details
Consent state ( analytics_storage , ad_storage , ad_user_data , ad_personalization )
Banner to Google tag
Sets a default before any tag runs, then updates it when the visitor chooses
purchase and refund with transaction_id
Browser, server, or both
Sends your real order ID so duplicates collapse into one
Server events (payment confirmed, subscription renewed, offline sale)
Your server to GA4, through the Measurement Protocol
Posts the event with the visitor's client_id so it joins the same user
Raw event export
GA4 to BigQuery
Feeds dashboards and joins with order data
Event design: the mapping to agree first
Google's ecommerce guide lists the recommended events in funnel order: view item list, select item, view item, add to and remove from cart, begin checkout, add shipping info, add payment info, purchase, refund. The mapping below is the document to settle before anyone opens Tag Manager.
Business action
GA4 event
Parameters that must be right
Product page opened
view_item
items with ID, name, price; currency , value
Added to cart
add_to_cart
items with quantity; currency , value
Checkout started
begin_checkout
items , value , currency
Order paid
purchase
transaction_id , value , tax , shipping , currency , items
Order refunded
refund
The original transaction_id
Lead form sent
generate_lead
Form name as a custom parameter
The main flow, step by step
Write the event plan. One row per action, with its name, parameters and the page or server step that triggers it.
Build the data layer. The site pushes structured data for each action. Tags read from it; they do not scrape the page.
Set consent defaults. Google's guide requires the consent default command on every page before any command that sends measurement data, and the update command on the page where the visitor makes a choice.
Configure tags in GTM , or the Google tag directly, to send each data layer event to GA4.
Add server events. For payment, refund and renewal, post to https://www.google-analytics.com/mp/collect with the stream's measurement_id , an api_secret and the visitor's client_id .
Validate. Send test payloads to Google's validation server ( /debug/mp/collect ); events sent there do not appear in reports.
Mark key events and register custom dimensions in GA4, then compare a week of GA4 purchases against the order system.
Limits and rules Google documents
Rule
What the documentation says
Event names
40 characters at most
Parameters
25 per event; names up to 40 characters, values up to 100
User properties
25 per property; names up to 24 characters, values up to 36
Property limits, standard
50 event-scoped custom dimensions, 30 key events, 100 audiences
Measurement Protocol purpose
Meant to add to tagging, not replace it; Google says tagging is required to use it
Measurement Protocol requests
Up to 25 events per request; events can be backdated up to 72 hours
Measurement Protocol errors
Returns a 2xx status even when the payload is malformed, so failures are silent
Duplicate purchases
Deduplicated on the same transaction ID, on web data streams
Consent mode
Basic: tags stay blocked until the visitor interacts with the banner. Advanced: tags load with consent denied and send cookieless pings
Data retention, standard
2 or 14 months for user and event data; it affects explorations and funnel reports, not standard aggregated reports
BigQuery export, standard
Daily export is limited to 1 million events; streaming export has no event limit
Server-side tagging
The server container runs in your own cloud project; Cloud Run is the recommended option
Common failure modes
The tag is blocked by the site's own security header. A Content-Security-Policy that does not list Google's hosts stops the tag without any visible error. Google's CSP guide lists https://www.googletagmanager.com under script-src-elem , img-src and connect-src , with https://*.google-analytics.com added to img-src and connect-src for GA4, and recommends a server-generated nonce for the container script.
Server events vanish. A wrong api_secret or measurement_id still returns a success status, and Google notes that the validation server does not check those two values.
Purchases counted twice or not at all. No transaction_id , or a thank-you page that reloads.
Consent set too late. The default arrives after the first tag has fired.
Server events create a second user. The client_id from the browser was not stored with the order.
A year-on-year exploration comes back empty. Retention was left at 2 months.
A password-protected store sends nothing. Shopify's help centre notes that GA4 cannot track events until private mode is switched off.
What WavX builds around it
For a client who needs GA4 set up properly, WavX builds:
The event plan and a data layer implemented in the site's code, for Next.js, React, custom stores and Shopify themes.
A consent banner wired to Google's four consent parameters, with the default set before any tag.
GTM web containers, and a server container where first-party collection is wanted.
Server-side purchase and refund events from the order system, keyed on your order ID.
A scheduled comparison of GA4 purchases with orders, so drift is seen early.
BigQuery export and reporting where a custom dashboard is needed.
The same event plan feeds ad platforms; see Meta Pixel and Conversions API setup and the performance marketing service . Tracking visits that arrive from AI assistants is covered in measuring AI referral traffic in GA4.
WavX does not publish a price for a single integration; it is quoted after scoping. For planning, the software cost estimator carries third-party integrations as a ₹60,000 feature line on top of a base build. Its output is a planning range, not a quote. Other integrations are listed under API and system integration services.
When Google's own tools are enough
A brochure site with one enquiry form. Install the Google tag, switch on enhanced measurement, mark the form submission as a key event. No developer needed.
A standard Shopify store. Shopify's Google & YouTube channel connects GA4 and sends the standard ecommerce events.
You only need traffic totals. The default reports answer that without custom events.
Custom work earns its cost when revenue in GA4 has to match the order system, when ad spend is optimised against those numbers, or when consent and security headers make the default install fail quietly.
Frequently asked questions
Do I need Google Tag Manager, or is the Google tag enough?
A site with a handful of events can use the Google tag on its own. Tag Manager earns its place when several tools (GA4, Google Ads, Meta) need the same events, or when a marketer has to change tags without a code release. Either way the events come from a data layer that a developer maintains.
Why does GA4 show fewer purchases than my order system?
The usual causes are a purchase event that only fires on a thank-you page the customer never reaches, visitors who declined analytics consent, and browser blocking. A server-side purchase event sent through the Measurement Protocol closes the first gap. The consent gap is by design and should not be worked around.
Can a purchase be counted twice?
Yes, when a thank-you page is reloaded or both the browser and the server report the sale. Google's help centre says GA4 deduplicates purchase events that carry the same transaction ID on web data streams, so every purchase event must carry your real order ID.
Does GA4 cost anything?
This page does not quote a Google price. Google documents two tiers, standard properties and Analytics 360, with 360 carrying higher limits. On a standard property the costs that appear are indirect: BigQuery storage and queries if you export raw events beyond the sandbox, and hosting if you run a server-side container.
How much does WavX charge for a GA4 setup?
We do not publish a price for a single integration; it is quoted after scoping. For planning, our software cost estimator carries third-party integrations as a ₹60,000 feature line on a larger build. That is a planning figure, not a quote.
Sources
Google Analytics Help: event collection limits · read 2 October 2026
Google Analytics Help: standard properties and Analytics 360 limits · read 2 October 2026
Google for Developers: measure ecommerce (GA4) · read 2 October 2026
Google Analytics Help: recommended events · read 2 October 2026
Google Analytics Help: enhanced measurement events · read 2 October 2026
Google Analytics Help: transaction IDs and duplicate purchases · read 2 October 2026
Google for Developers: Measurement Protocol (GA4) overview · read 2 October 2026
Google for Developers: Measurement Protocol reference (web streams) · read 2 October 2026
Google for Developers: validating Measurement Protocol events · read 2 October 2026
Google for Developers: set up consent mode · read 2 October 2026
Google for Developers: consent mode overview (basic and advanced) · read 2 October 2026
Google for Developers: server-side tagging introduction · read 2 October 2026
Google for Developers: using Tag Manager with a Content Security Policy · read 2 October 2026
Google Analytics Help: data retention · read 2 October 2026
Google Analytics Help: BigQuery export · read 2 October 2026
Shopify Help Center: setting up Google Analytics · read 2 October 2026
Related
Meta Pixel and Conversions API setup
Performance marketing (Meta and Google Ads)
How to track your website analytics
Build your own software — your way, your pricing.
WavX Solutions is here to create your own software in a fully custom way, built exactly how you work — with a pricing model that fits your business. Connect now and let's build it.
Contact Now helpwavx@gmail.com