You created a site. Now you need to know who visits it. Adding Google Analytics to your website is the single fastest way to flip the lights on โ and it's free. The 2026 version is Google Analytics 4, and the install boils down to three moving parts: a Google account, a GA4 property with a Measurement ID, and a snippet of code on your site. That's it.
Most guides skip the part that actually trips people up โ picking the right install method for your stack. WordPress, Shopify, Wix, Webflow, a hand-coded HTML site, a Next.js app โ each one has its own path. Pick the wrong path and you'll spend the afternoon debugging Real-Time reports that never show your visit. We'll walk every option in order.
Worth knowing up front: every step below is reversible. You can swap install methods later. You can delete the property and start fresh. You can move the snippet from <head> to <body> and back. Nothing here is permanent until you're collecting clean data โ at which point you'll want to leave it alone. The goal of this guide is to get you to that point fast, without breaking your site.
If you've already got a GA4 property and just need the snippet, jump to Step 2. If you're new to GA4 entirely, start with the prerequisites below โ the how to use Google Analytics primer covers what each report does once data starts flowing. And if you're shopping for help, our Google Analytics consultant guide covers fees and what to expect.
Quick reality check before you start: GA4 is forgiving. You won't break anything by clicking around the Admin panel. The worst-case scenario for a botched install is no data โ not corrupted data. That makes this a great project to do on a Friday afternoon. Pour coffee. Open Admin. Let's go.
One more thing about scope. This guide focuses on the install itself โ getting GA4 to receive your first pageview cleanly. We aren't covering the full reporting layer (that's a different beast), and we aren't covering app SDKs for iOS or Android. Web only. If you need mobile app tracking, you'll add a separate data stream after the web stream is live and wire up the Firebase SDK โ outside today's job.
The honest answer about timing: a clean WordPress or Shopify install takes 10 minutes. A custom HTML site with templating takes 20. A Next.js or React app takes 30 to an hour, mostly figuring out where the Script component goes. Plan accordingly. Don't start at 4:55pm on Friday unless you're fine with leaving it half-done over the weekend.
What you'll have at the end of this guide: a working GA4 property tied to your domain, the gtag.js or GTM snippet live on every page, Real-Time confirming visitors are being counted, Enhanced Measurement auto-tracking scrolls and downloads, and at least one conversion event marked. That's the bare-minimum production setup. Anything past that โ custom events, audiences, BigQuery exports, server-side tagging โ is optimization, not install. Get the basics live first. Optimize later.
Final note on tooling. Keep two browser tabs open through the install: one on analytics.google.com (Admin panel), one on your site. Switch between them constantly. A third tab on tagmanager.google.com if you're going the GTM route. You'll save yourself the frustration of navigating away and losing your place. Bookmark the Data Streams page โ it's the page you'll come back to most often once you're collecting data.
The Google account you use to create the property owns the property forever. If that login dies โ employee leaves, account locked, password reset disaster โ you lose admin access. Use a shared company email like analytics@yourdomain.com. Set up at least two admin users on day one. Future you will say thanks.
GA4 hides setup behind the gear icon. You'll see three columns: Account, Property, Data Stream. If this is your first time, only the Account column will have an entry โ your default empty account.
Pick the account name carefully โ it shows on every report. Use the legal business name, not the website name. Toggle the four data-sharing checkboxes based on your privacy stance. Most marketers leave all four on. Privacy-strict orgs turn them off.
Property name should describe the website or app โ "Acme Corp Marketing Site" or "Acme Mobile App." Time zone affects when reports start and end each day. Currency is reporting only โ doesn't convert your revenue.
GA4 uses these to suggest reports and benchmark anonymously. Pick the closest fit โ "Internet & Telecom" is a safe default for digital products. Business size is by employee count.
Choose 2โ3 goals like "Examine user behavior" and "Generate leads." These customize the default report navigation. You can change later under Admin โ Reports.
Click Web, paste your full URL with https://, name the stream (just "Website" is fine), and decide whether to keep Enhanced Measurement on. Keep it on โ it's the magic that auto-tracks scrolls, outbound clicks, downloads, and video.
After clicking Create Stream, you'll see a panel with the Measurement ID at the top, plus the gtag.js snippet below it. The Measurement ID is what you'll need on every page going forward. Copy it.
GA4 saves automatically. You can close this tab now โ your property exists and is waiting for data. Next: get the code onto your site.
Copy the snippet GA4 generates. Paste before the closing </head> tag on every page. Best for: static sites, custom HTML, full control. Worst for: needing to deploy code every time you tweak tracking.
Install one GTM container, then manage every tag (GA4, Meta Pixel, conversion pixels) from a web UI without editing site code. Best for: marketers, agencies, multi-tag stacks. The recommended path for anyone past beginner.
WordPress, Shopify, Wix, Squarespace all have one-click GA4 integrations. Paste the Measurement ID into a settings field โ done. Best for: non-technical owners, no-code sites. Worst for: advanced event tracking.
Here's where most guides hand-wave. Every platform hides the GA4 setting in a different menu, calls it a different name, and has a different gotcha. Below is the click path for the platforms that cover roughly 95% of websites in 2026.
Three routes, ranked easiest to hardest. Site Kit by Google โ the official Google plugin. Free. Install from the WordPress plugin directory, click Set Up, sign into the same Google account that owns your GA4 property, select the property, done. It also wires up Search Console, AdSense, and PageSpeed in the same flow.
MonsterInsights โ the popular third-party plugin. Free tier works for most sites. Premium runs $99โ$799/year and adds eCommerce tracking, custom dimensions, and a dashboard widget. Insert Headers and Footers is the leanest option โ paste the gtag.js snippet into the Header box. No analytics dashboards inside WordPress, just clean tracking.
Two options. Native integration: Admin โ Online Store โ Preferences โ Google Analytics section โ paste your Measurement ID. That's the old way and still works. Customer Events (recommended for 2026): Settings โ Customer Events โ Add Custom Pixel.
The Customer Events route gives you proper purchase event tracking with revenue, items, and transaction ID โ the native integration misses most of that. The Google Analytics website traffic guide breaks down how to read what comes through.
Wix: Site Dashboard โ Marketing & SEO โ Marketing Integrations โ Google Analytics. Click Connect, sign in with Google, pick your property. Wix handles the snippet injection automatically. Free Wix sites with .wix.com URLs can't add custom analytics โ you need a paid plan with your own domain.
Squarespace 7.1: Settings โ Advanced โ External API Keys โ Google Analytics 4. Paste your Measurement ID. Save. Squarespace adds the gtag.js to every page automatically. If you're on a legacy Squarespace 7.0 site, the menu lives under Settings โ Advanced โ Code Injection โ paste the full gtag snippet into the Header box instead.
Project Settings โ Integrations โ Google Analytics โ paste Measurement ID โ Save Changes โ Publish site. Webflow won't push until you click Publish. For GTM, use Custom Code โ Head Code instead.
Install JCH Optimize or Google Analytics for Joomla extension and paste your Measurement ID. Or open the template's index.php and paste gtag.js inside the head tag. Always backup the template first.
Install the Google Analytics module from drupal.org/project/google_analytics. Configure at /admin/config/system/google-analytics. Handles role exclusions, path filters, and consent integration out of the box.
Paste gtag.js before the closing head tag on every page. Use a shared header include (PHP, Eleventy partial, Hugo layout, Jekyll _includes) so you paste once, not 200 times.
Next.js: drop gtag.js in _app.tsx using next/script with strategy afterInteractive. React: npm install react-ga4, init in root, fire page_view on route changes.
Vue, Angular, and Svelte don't fire pageviews on route change. Hook into router events (Vue afterEach, Angular Router.events, Svelte page store) and manually call gtag for page_view.
If you'll ever run more than one tag โ GA4, Meta Pixel, LinkedIn Insight, conversion pixels, custom events โ install once via GTM and stop editing site code forever. Create a GTM container at tagmanager.google.com. Paste the GTM snippet (not the GA4 snippet) into your site's <head> and right after the opening <body> โ both halves are needed.
Inside GTM, add a new Tag, pick GA4 Configuration, paste your Measurement ID, set the trigger to All Pages. Click Submit, then Publish. Done. From now on, every new tag (heatmaps, A/B tests, ads) gets added inside GTM without touching site code.
One catch worth flagging: GTM and direct gtag.js installed on the same site will fire two pageviews per visit. Pick one. If you migrate from gtag to GTM, remove the original gtag snippet from the site code. The Google Analytics not provided keywords guide explains a related double-counting issue you'll want to avoid.
The other thing GTM unlocks: built-in preview and debug mode. Click Preview inside the GTM workspace, type your site URL, and a debugger window opens alongside the live page. Every tag fire, every variable, every trigger evaluation shows up in the debug panel as you click around. This is how serious tracking gets done โ you'd never know your form submit tag wasn't firing without seeing the trigger evaluation fail in debug mode. Direct gtag.js gives you no such window into what's happening.
Worth noting for compliance-heavy sites: GTM also supports server-side tagging. You spin up a GTM container on Google Cloud Run, fire events to your server endpoint, and the server forwards them to GA4. This keeps the user's browser from talking to google-analytics.com directly โ better for performance, better for privacy, harder for ad blockers to detect. The setup runs $40โ120/month in Cloud Run costs, so it's overkill for small sites. Worth it once you're past 100k monthly users.
Easiest: Install Site Kit by Google plugin โ Set Up โ sign in โ pick GA4 property โ Save.
Lean: Install Insert Headers and Footers โ paste gtag.js snippet in Header box โ Save.
Premium: Install MonsterInsights โ authenticate โ pick property โ enable eCommerce tracking if needed.
Verify within 24 hours via Real-Time report. WordPress caching plugins (W3 Total Cache, WP Rocket) can delay snippet appearance โ clear cache after install.
Native: Admin โ Online Store โ Preferences โ Google Analytics โ paste Measurement ID โ Save.
Better (purchase tracking): Settings โ Customer Events โ Add Custom Pixel โ paste GA4 pixel code โ connect to Measurement ID. This captures purchase events with items, revenue, and transaction ID โ the native integration misses these.
Disable Shopify's checkout app blocker if you don't see checkout pageviews. The Customer Events route is the 2026 recommended setup.
Site Dashboard โ Marketing & SEO โ Marketing Integrations โ Google Analytics โ Connect โ sign in โ pick GA4 property โ Save.
Wix injects gtag.js into every page automatically. Republish the site after saving (Wix shows a banner).
Important: Wix free sites with .wix.com URLs can't add Google Analytics. You need a paid plan with your own domain to integrate GA4.
Squarespace 7.1: Settings โ Advanced โ External API Keys โ Google Analytics 4 โ paste Measurement ID โ Save.
Squarespace 7.0: Settings โ Advanced โ Code Injection โ Header โ paste full gtag.js snippet โ Save.
Squarespace doesn't expose the data layer, so custom event tracking is limited. For eCommerce tracking, use Squarespace's built-in Commerce reports alongside GA4 โ don't expect full purchase events without GTM.
Open every page's HTML. Paste the gtag.js snippet just before the closing </head> tag. Save and upload via FTP, SFTP, or your build pipeline.
Smart approach: Use a shared header include (PHP include, Eleventy partial, Hugo layout) so you paste the snippet once and it appears on every page. Never copy-paste 200 times โ one typo breaks tracking everywhere.
For Next.js/React, use the Script component with strategy="afterInteractive". For SPAs, manually fire page_view events on route change.
Install isn't the win. Data is the win. Three ways to confirm GA4 is firing โ use all three before you walk away. Method 1: Tag Assistant Companion. Install the Tag Assistant Companion Chrome extension. Visit your site. Click the Tag Assistant icon โ you should see a green check for "Google tag (gtag.js)" with your Measurement ID. Red X or missing? The snippet isn't loading.
Method 2: Real-Time report. Open GA4 โ Reports โ Realtime. Visit your own site in another tab. Within 30 seconds you should see yourself as an active user. Country, browser, device, and page path all populate live. If nothing shows up after two minutes, the snippet isn't reaching GA4.
Method 3: Chrome DevTools Network filter. Open DevTools (F12) โ Network tab โ filter by "collect." Refresh the page. You should see one or more requests to google-analytics.com/g/collect on every page load. Click one โ the Payload tab shows the event name, page path, and your Measurement ID.
If DevTools shows the request, GA4 is receiving it. Standard reports (Acquisition, Engagement, etc.) lag 24โ48 hours behind live data on day one. Don't panic if your dashboards are empty the morning after install โ Real-Time should be working, and the rest catches up by tomorrow. Worth flagging: if you've got the GA4 DebugView open and aren't seeing events, you also need the Google Analytics Debugger Chrome extension installed and enabled. Without it, debug mode events route to the regular stream and never appear in DebugView.
This is the free magic GA4 ships with that Universal Analytics charged for. Admin โ Data Streams โ click your web stream โ toggle Enhanced Measurement on (if it isn't already). It auto-tracks scrolls past 90% of the page, outbound link clicks, site search (if your URL uses ?q=), embedded video plays/pauses/completes, and file downloads. Zero code required. Click the gear inside Enhanced Measurement to toggle individual sub-features off if you don't want them.
One thing Enhanced Measurement won't do: track form submissions. GA4 has no built-in form_submit event. You'll need to either fire a custom event from your form's onSubmit handler, or use GTM with a Form Submission trigger. Most contact forms render as JavaScript, so the standard GTM form trigger fails โ you'll end up firing events on button click or thank-you page load instead. Plan for this upfront.
GA4 collects events automatically (page_view, scroll, click, file_download). You decide which events count as conversions. Admin โ Events โ toggle the Mark as Conversion switch next to events that matter to your business โ purchase, generate_lead, sign_up, contact form submit. Conversions appear in the Conversions report and feed into Google Ads and Search Ads 360 if you've linked them. Most sites mark 3โ5 events as conversions โ too many and the dashboard gets noisy.
Admin โ Property Settings โ Search Console Links โ Link. Pick your verified Search Console property. This brings organic search query data into GA4 (when not redacted). For Google Ads, Admin โ Property Settings โ Google Ads Links โ Link. This enables conversion import and remarketing audiences. If you also use BigQuery for advanced analytics, the link is in the same section โ free up to 1 GB of export per day. The Google Analytics for SEO guide walks through the Search Console link in detail.
No data after 24 hours. First check view source on a live page โ is the gtag.js snippet actually there? If a caching plugin stripped it, clear cache. If a security plugin's minifier broke it, exclude analytics from minification. If neither โ check the Measurement ID matches between your site code and your Data Stream. One character off, no data.
Duplicate pageviews. You probably have GTM and gtag.js both installed. Remove one. View source โ there should be exactly one analytics-related script block. Real-Time works but reports are empty. Reports lag 24โ48 hours on a fresh install. Wait. If after three days the reports are still blank, check Admin โ Data Settings โ Data Retention is set to 14 months, not 2 months.
Ad blockers. Roughly 25% of users run ad blockers in 2026, and most block Google Analytics by default. Your reports will undercount real traffic by 20โ30%. This is the universal GA limitation โ server-side tracking via the Measurement Protocol is the workaround if you need exact counts. The what is Google Analytics primer covers what you can and can't measure.
Cross-domain tracking missing. If you have multiple domains (example.com and shop.example.com or two separate brand domains), open Admin โ Data Streams โ your stream โ Configure tag settings โ Configure your domains โ add each domain. Without this, GA4 treats a visitor crossing domains as two separate users.
If you serve EU users, you need Consent Mode v2. Without it, you lose ad personalization and conversion modeling from EU visitors. The fix: install Cookiebot, Iubenda, or OneTrust as your consent management platform (CMP). Connect it to GA4. The CMP fires consent signals (granted or denied) before the gtag.js loads. GA4 then models the missing conversions probabilistically from the consented data. For EU-only sites, this isn't optional โ it's required for Google Ads to keep importing conversions.
For US sites worried about California's CPRA, the same setup applies โ the CMP just shows different banners depending on the visitor's location. That covers install. The hard part is now done. Spend tomorrow exploring the reports โ the Acquisition, Engagement, and Monetization sections cover almost every business question. If you want to go deeper, the Google Analytics course roundup covers the best free and paid training, and the Google data analytics certificate path is worth a look if you're building this into a career.
Sign in to analytics.google.com โ Admin โ Create Account โ Create Property โ set time zone and currency โ add a Web data stream with your site URL โ copy the Measurement ID (G-XXXXXXXXXX) โ paste the gtag.js snippet before the closing </head> tag on every page, or install via your CMS plugin or Google Tag Manager. Verify in Real-Time within 30 seconds.
Open Admin โ Data Streams โ click your web stream โ the Measurement ID (G-XXXXXXXXXX) is at the top of the panel. It's a 10-character string starting with G-. Don't confuse it with the Stream ID (numeric) or the older Universal Analytics tracking ID (UA-XXXXXXX-X). GA4 uses the G- format only.
Real-Time data appears within 30 seconds of install. Standard reports (Acquisition, Engagement, Monetization) lag 24โ48 hours behind on a fresh property. If Real-Time works but standard reports stay empty after three days, check that data retention is set to 14 months under Admin โ Data Settings โ Data Retention, not the default 2 months.
Yes. Install Site Kit by Google (the official free plugin) from the WordPress directory, click Set Up, sign in with the same Google account that owns your GA4 property, pick the property from the dropdown. Done. Alternatively, MonsterInsights offers free and paid tiers ($99โ$799) with built-in eCommerce tracking. Both options avoid any code editing.
Two routes. Native: Admin โ Online Store โ Preferences โ Google Analytics โ paste your Measurement ID. Recommended: Settings โ Customer Events โ Add Custom Pixel โ paste a GA4 pixel snippet. The Customer Events route captures full purchase events with revenue, items, and transaction ID โ the native integration misses most of that data.
GTM if you'll ever run more than one tracking pixel โ GA4, Meta Pixel, LinkedIn Insight, conversion pixels, heatmaps. Install GTM once, manage every tag from a web UI without editing site code. Direct gtag.js if you only need GA4 and want the leanest possible setup. Never install both โ they fire duplicate pageviews and double your session counts.
Three checks. Tag Assistant Companion Chrome extension shows a green check next to gtag with your Measurement ID on every page. Real-Time report in GA4 shows you as an active user within 30 seconds of visiting your own site. Chrome DevTools Network tab filtered by "collect" returns requests to google-analytics.com on every page load. Pass all three before walking away.
Most common causes: wrong Measurement ID pasted in site code (one character off, no data), a caching plugin stripping the snippet (clear cache), security or minifier plugin breaking gtag.js (exclude analytics from minification), or your own ad blocker blocking the script during testing (disable the ad blocker). Check view source on a live page โ if the snippet isn't visible, that's your problem.
Yes, if you serve any EU traffic. Without Consent Mode v2, GA4 loses ad personalization and conversion modeling from EU users, and Google Ads stops importing conversions properly. Install a consent management platform (Cookiebot, Iubenda, OneTrust), connect it to GA4. The CMP fires consent signals before gtag.js loads. For US-only sites, Consent Mode is optional but recommended for CPRA compliance.
Create one property per website inside the same account. Admin โ Property column โ Create Property โ name it after the second site โ add a Web data stream with that site's URL โ get a separate Measurement ID. Each property has independent reports. One Google Analytics account can hold up to 100 properties on the free tier. For cross-domain tracking (one user visiting both sites counted as one visitor), use Configure Domains in the data stream settings.