Set Up Google Analytics 4 and Track What Matters
On this page
Analytics setups rarely fail on the technical install — they fail because nobody decided what to measure. This guide starts with the decisions, then walks through the GA4 property, the tag and the first events worth tracking.
Step 1 — Create the property
- Create a Google Analytics account and a new GA4 property
- Set the time zone and currency to the ones your business bills in
- Enter your website URL as a data stream
- Note the Measurement ID (G-XXXXXXX) — you'll need it next
Step 2 — Install the tag
Paste the global site tag into the `<head>` of every page. In a Next.js project that means the root layout; in most site builders there is a "custom code" field for exactly this:
html
<script async
src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');
</script>If you use Google Tag Manager, add the container snippet instead and install GA4 as a tag inside it. Verify with GA4's DebugView or the Tag Assistant extension before announcing victory.
Step 3 — Define the events that matter
GA4 auto-collects basics like `page_view` and `session_start`. The useful part is adding events tied to your goal. For a service business, a smaller set beats a giant list you never read:
- `generate_lead` — contact form or WhatsApp click
- `begin_checkout` / `purchase` — for stores
- `sign_up` — newsletter or account creation
- `scroll` / `file_download` — only if content is part of the strategy
“Track the five events that change a business decision. The rest is decoration.”
Step 4 — Build one report you'll actually open
- Save a report showing conversions by channel
- Add the landing pages that bring converting traffic
- Check it on the same weekday each week
- Change one thing, then compare the next two weeks
That's the whole habit: measure, change, compare. If you'd rather have someone set this up and interpret it, my digital marketing services include analytics configuration as part of a wider strategy — or get in touch and tell me what you're trying to learn.
Sample article — preview content for this portfolio design.
Written by
Anurag Singh
Digital Marketing Expert
I specialize in digital marketing, SEO, and web development, helping businesses improve search visibility, strengthen their online presence, and grow through effective digital strategies.