{"id":6009,"date":"2025-05-25T17:46:20","date_gmt":"2025-05-26T00:46:20","guid":{"rendered":"https:\/\/www.ultimatewb.com\/blog\/?p=6009"},"modified":"2025-07-14T12:44:25","modified_gmt":"2025-07-14T19:44:25","slug":"how-to-set-up-google-analytics-4-ga4-for-your-website-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/www.ultimatewb.com\/blog\/6009\/how-to-set-up-google-analytics-4-ga4-for-your-website-a-step-by-step-guide\/","title":{"rendered":"How to Set Up Google Analytics 4 (GA4) for Your Website: A Step-by-Step Guide"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/google-analytics-4-website-traffic-data.png\">    <picture>\n                <img src=\"https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/google-analytics-4-website-traffic-data.png\"\n             srcset=\"https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/google-analytics-4-website-traffic-data.png 379w, https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/google-analytics-4-website-traffic-data-300x105.png 300w\"             sizes=\"(max-width: 600px) 100vw, (max-width: 1200px) 75vw, 1200px\"\n             width=\"379\"\n             height=\"133\"\n             alt=\"google-analytics-4-website-traffic-data\"\n             loading=\"lazy\"             decoding=\"async\"\n             class=\"wp-image-6013\" >\n    <\/picture>\n    <\/a><\/figure>\n\n\n\n<p>Understanding how people interact with your website is key to improving it. How many visitors are you getting? Where are they coming from? What content do they find most useful? With the right data, you can make smarter decisions that drive real results.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Is Google Analytics Free?<\/strong><\/h2>\n\n\n\n<p>Yes &#8211; Google Analytics 4 (GA4) is completely free for most websites. It gives you powerful tools to track visitor behavior, measure performance, and grow your online presence &#8211; all without paying a cent. There\u2019s also a premium version, Google Analytics 360, but it\u2019s designed for large enterprises and isn\u2019t necessary for most users.<\/p>\n\n\n\n<p>Now let\u2019s walk through how to set up GA4 on your website:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What You\u2019ll Need<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Google Account (like your Gmail).<\/li>\n\n\n\n<li>Access to your website\u2019s backend or a place where you can add custom code.<br><em>(With the UltimateWB website builder, yuo can use the built-in Ad(d)s app to easily add the Google-provided custom coding.)<\/em><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 1: Create a Google Analytics 4 Property<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Visit <a href=\"https:\/\/analytics.google.com\" target=\"_blank\" rel=\"noreferrer noopener\">Google Analytics<\/a> and sign in with your Google account.<\/li>\n\n\n\n<li>If you don\u2019t have an account yet, click <strong>Start measuring<\/strong> to create one.<\/li>\n\n\n\n<li>Create a new Account if prompted &#8211; this groups your properties together. Use a clear name, such as your business or website name.<\/li>\n\n\n\n<li>Click <strong>Admin<\/strong> (gear icon in the bottom-left).<\/li>\n\n\n\n<li>In the <strong>Property<\/strong> column, click <strong>Create Property<\/strong>.<\/li>\n\n\n\n<li>Enter a name for your property (e.g., \u201cYour Website GA4\u201d).<\/li>\n\n\n\n<li>Select your time zone and currency, then click <strong>Next<\/strong>.<\/li>\n\n\n\n<li>Provide optional business info (industry, size, goals) to help Google customize your reports, then click <strong>Create<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 2: Set Up a Data Stream for Your Website<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>After creating your property, you\u2019ll be directed to the <strong>Data Streams<\/strong> page.<\/li>\n\n\n\n<li>Click <strong>Web<\/strong> to create a stream for your website.<\/li>\n\n\n\n<li>Enter your website URL (including https:\/\/) and name the stream (like \u201cMain Website Traffic\u201d).<\/li>\n\n\n\n<li>Leave <strong>Enhanced Measurement<\/strong> enabled &#8211; it tracks useful interactions like pageviews, scrolls, clicks, and video engagement automatically.<\/li>\n\n\n\n<li>Click <strong>Create stream<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 3: Get Your Measurement ID and Google Tag<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Once your stream is created, find your <strong>Measurement ID<\/strong> at the top of the stream details &#8211; it looks like <code>G-XXXXXXXXXX<\/code>.<\/li>\n\n\n\n<li>Click <strong>Tagging Instructions<\/strong> to see how to install your tracking code.<\/li>\n\n\n\n<li>You\u2019ll find the <strong>Global Site Tag (gtag.js)<\/strong> code snippet here, which you\u2019ll add to your website.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 4: Add the GA4 Tracking Code to Your Website<\/strong><\/h2>\n\n\n\n<p>For <strong>Google Analytics 4 (GA4)<\/strong>, you should paste the tracking code <strong>inside the <code>&lt;head&gt;<\/code> section<\/strong> of your website.<\/p>\n\n\n\n<p><strong>For UltimateWB Users:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/edit-add-head-section.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"320\" src=\"https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/edit-add-head-section-1024x320.jpg\" alt=\"Edit Ad(d), Head section\" class=\"wp-image-6014\" style=\"width:840px;height:auto\" srcset=\"https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/edit-add-head-section-1024x320.jpg 1024w, https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/edit-add-head-section-300x94.jpg 300w, https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/edit-add-head-section-768x240.jpg 768w, https:\/\/www.ultimatewb.com\/blog\/wp-content\/uploads\/edit-add-head-section.jpg 1224w\" sizes=\"(max-width: 600px) 100vw, (max-width: 1200px) 75vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log in to your UltimateWB website admin panel.<\/li>\n\n\n\n<li>Go to the <strong>Ad(d)s section<\/strong>.<\/li>\n\n\n\n<li>Find the Ad(d) marked: &#8220;In head section, right before end head tag&#8221;.<\/li>\n\n\n\n<li>Click on the Edit button, and on this page: Paste the full gtag.js snippet<\/li>\n\n\n\n<li>Save your changes.<\/li>\n<\/ul>\n\n\n\n<p><strong>For WordPress Users:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Recommended:<\/strong> Install the official Site Kit by Google plugin or another Google Analytics plugin.<\/li>\n\n\n\n<li>Simply enter your Measurement ID in the plugin\u2019s settings, and it handles the rest.<\/li>\n\n\n\n<li>Or, if you prefer manual setup, add the full gtag.js code to your theme\u2019s header.php file just before the closing <code>&lt;\/head&gt;<\/code> tag (using a child theme is best).<\/li>\n<\/ul>\n\n\n\n<p><strong>For Other Websites (HTML\/PHP):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Copy the gtag.js snippet.<\/li>\n\n\n\n<li>Paste it inside the <code>&lt;head&gt;<\/code> tag on every page, near the top for best performance.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why paste in the <code>&lt;head&gt;<\/code>?<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Placing the GA4 <strong>Global Site Tag (gtag.js)<\/strong> in the <code>&lt;head&gt;<\/code> ensures the tracking code loads early.<\/li>\n\n\n\n<li>This helps GA4 capture important user interactions and pageviews immediately as the page loads.<\/li>\n\n\n\n<li>It improves accuracy, especially for fast-loading sites or single-page apps where early events matter.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What about before the <code>&lt;\/body&gt;<\/code> tag?<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Some scripts are loaded just before <code>&lt;\/body&gt;<\/code> to speed up page rendering or for scripts that aren\u2019t needed immediately.<\/li>\n\n\n\n<li>But GA4 tracking code is best placed in the <code>&lt;head&gt;<\/code> because it needs to start tracking as soon as possible.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 5: Verify Your GA4 Setup Is Working<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to your GA4 property and open the <strong>Realtime<\/strong> report.<\/li>\n\n\n\n<li>Visit your website in a new browser tab and browse a few pages.<\/li>\n\n\n\n<li>You should see your activity appear in GA4 within seconds.<\/li>\n<\/ul>\n\n\n\n<p>To double-check, you can also use the <strong>Google Tag Assistant<\/strong> Chrome extension, which shows which Google tags are detected on your site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 6: Optional but Recommended Settings<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Link <a href=\"https:\/\/www.ultimatewb.com\/blog\/?s=google+search+console\">Google Search Console<\/a>:<\/strong> Connect your GA4 property with Search Console for detailed SEO insights (Admin \u2192 Product Links \u2192 Search Console).<\/li>\n\n\n\n<li><strong>Adjust Data Retention:<\/strong> Extend data storage from 2 months to 14 months (Admin \u2192 Data Settings \u2192 Data Retention).<\/li>\n\n\n\n<li><strong>Filter Internal Traffic:<\/strong> Exclude visits from your office or home IP to keep your data clean (Admin \u2192 Data Streams \u2192 Your Web Stream \u2192 More Tagging Settings \u2192 Define Internal Traffic).<\/li>\n<\/ul>\n\n\n\n<p>Setting up Google Analytics 4 gives you valuable insight into your audience and website performance. With GA4 tracking in place, you\u2019re ready to make smarter, data-driven decisions that help your site grow.<\/p>\n\n\n\n<p>If you want help or have questions about GA4 setup, just ask!<\/p>\n\n\n\n<p>Related: <a href=\"https:\/\/www.ultimatewb.com\/blog\/7087\/why-we-dont-use-google-analytics-on-our-website\/\">Why We Don\u2019t Use Google Analytics on Our Website<\/a><\/p>\n\n\n\n<p>Are you ready to design &amp; build your own website? Learn more about&nbsp;<a href=\"https:\/\/www.ultimatewb.com\/\">UltimateWB<\/a>! We also offer&nbsp;<a href=\"https:\/\/www.ultimatewb.com\/web-design-packages\">web design packages<\/a>&nbsp;if you would like your website designed and built for you.<\/p>\n\n\n\n<p><em>Got a techy\/website question? Whether it\u2019s about UltimateWB or another website builder, web hosting, or other aspects of websites, just send in your question in the&nbsp;<a href=\"https:\/\/www.ultimatewb.com\/ask-david\">\u201cAsk David!\u201d form<\/a>. We will email you when the answer is posted on the UltimateWB \u201cAsk David!\u201d section.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Understanding how people interact with your website is key to improving it. How many visitors are you getting? Where are they coming from? What content do they find most useful? With the right data, you can make smarter decisions that &hellip; <a href=\"https:\/\/www.ultimatewb.com\/blog\/6009\/how-to-set-up-google-analytics-4-ga4-for-your-website-a-step-by-step-guide\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,781],"tags":[1828,4297,4296,330,1655,4304,4303,4305,4299,4302,4300,4298,4301,893],"class_list":["post-6009","post","type-post","status-publish","format-standard","hentry","category-search-engine-optimization-seo","category-website-traffic","tag-clicks","tag-data-strems","tag-ga4","tag-google-analytics","tag-google-search-console","tag-google-tag-assistant","tag-google-tags","tag-internal-traffic","tag-pageviews","tag-realtime-report","tag-scrolls","tag-user-interactions","tag-video-engagement","tag-website-traffic-2"],"_links":{"self":[{"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/posts\/6009"}],"collection":[{"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/comments?post=6009"}],"version-history":[{"count":5,"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/posts\/6009\/revisions"}],"predecessor-version":[{"id":7092,"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/posts\/6009\/revisions\/7092"}],"wp:attachment":[{"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/media?parent=6009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/categories?post=6009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ultimatewb.com\/blog\/wp-json\/wp\/v2\/tags?post=6009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}