Business tech · Beginner · 16 min
Set up Google Analytics 4 for a small business website
By Padding · Updated 18 Nov 2026
Google Analytics 4 · November 2026
You will have a Google Analytics 4 property collecting visits behind a consent banner, an enquiry key event showing in the Realtime report, your own office traffic filtered out and three reports to read each month.
On this page
Ember Studio is a seven-person design agency with staff in Lagos and Nairobi and clients in the UK. Its website has a portfolio, a services page and an enquiry form. The team knows enquiries arrive, but not which pages people read first, whether the LinkedIn posts send anyone, or how many visitors start reading and leave.
In this tutorial you set up Google Analytics 4 (GA4) for that site. You create a property (the home for one website's data), add a web data stream (the connection from the site to the property), put the Google tag on every page behind a consent banner, and mark a sent enquiry as a key event, which is GA4's name for an action that matters to the business. Then you tidy the settings that most small sites leave on their defaults: how long detailed data is kept and whether the team's own visits count.
GA4 is free for a site of this size and it is what most agencies and freelancers will expect to find. It also sets cookies and sends visitor data to Google, which is why consent is part of the set-up and not an afterthought. If you want analytics without cookies or a banner, read add privacy-friendly analytics with Plausible before you start and pick one.
This tutorial explains what the law asks of most small sites in general terms. It is not legal advice; if your site handles health, financial or children's data, ask a data protection adviser.
Step 1 · Create the account and property
Sign in at analytics.google.com with the business's Google account and click Start measuring. If the business already has an Analytics account, go to Admin, click Create and choose Property instead.
For a new account:
- Name the account after the business:
Ember Studio. - Read the data sharing settings. Each one sends Analytics data to another Google service. Leave ticked only the ones you understand and can explain in your privacy notice; a site with no ad campaigns needs few of them.
- Click Next and name the property after the site:
emberstudio.example. Use your own domain here. - Choose the reporting time zone where most of the team works. Ember Studio picks Lagos, so a "day" in the reports runs midnight to midnight West Africa Time. Pick the currency you invoice in.
- Click Next, choose the industry and a business size, then choose what you plan to use Analytics for. Pick the options closest to "generate leads" and "understand web traffic"; they only change which reports appear first.
- Click Create, then read and accept the Terms of Service and the Data Processing Amendment.
Add a second person as an administrator now, so the property does not depend on one login. In Admin, under the property, open Property access management, click the plus button, add a colleague's work email and give them the Administrator role.
Check it worked
The property selector at the top of Analytics shows Ember Studio with the property emberstudio.example under it, and Property access management lists two people with the Administrator role.
Step 2 · Add a web data stream and choose enhanced measurement
Analytics usually asks for a data stream straight after you create the property. If you closed that screen, go to Admin, and under Data collection and modification click Data streams, then Add stream and Web.
- Enter the site address (
https://emberstudio.example) and a stream name such asEmber Studio website. - Leave Enhanced measurement on. It records common actions without extra code.
- Click Create stream.
Open the stream and click the gear icon next to Enhanced measurement to see what it collects. Page views are always on. The others are switches:
- Scrolls: someone reached the bottom of a page. Useful on long case studies.
- Outbound clicks: a click on a link to another site, such as your LinkedIn or Behance page.
- Site search: only useful if your site has a search box. Turn it off if not.
- Video engagement: plays of embedded YouTube videos.
- File downloads: clicks on links to PDFs and other files, such as a capabilities deck.
- Form interactions: someone started or submitted a form.
Form interactions only see forms built into your own pages. A form embedded from a form tool sits in a frame loaded from that tool's site, and your page's tag cannot see inside it. Ember Studio's form is embedded, so it turns Form interactions off and counts enquiries with a thank-you page instead (the key event step). Whatever you keep on, never put names, email addresses or phone numbers in page addresses or form names: Google's terms forbid sending personal details to Analytics.
Copy the Measurement ID from Stream details. It starts with G-. You need it in the next step.
Check it worked
Admin > Data streams lists one web stream for your domain, its Measurement ID starts with G-, and the enhanced measurement panel shows the switches you chose (Site search off if you have no search box).
Step 3 · Decide what consent you need
Before the tag goes on the site, decide how it asks for permission.
GA4 stores cookies in the visitor's browser and sends Google details of their visit. In the EU, storing anything on a visitor's device that is not strictly needed for the site to work needs their consent under the ePrivacy Directive, and the GDPR sets what counts as consent: a free, informed, clear choice, as easy to refuse as to accept, and as easy to withdraw later. Google also makes it a contract term. Its EU user consent policy says that for visitors in the European Economic Area, the UK and Switzerland, you must get valid consent where the law requires it, keep records of that consent and tell visitors how to withdraw it.
Other places Ember Studio's visitors come from:
- UK: the Data (Use and Access) Act 2025 added some exceptions to the cookie consent rule, including one for certain analytics. The exception is narrow, and the ICO's guidance says it does not cover tools that use the data for their own purposes. Until you have read the ICO's current guidance, treat GA4 as needing consent.
- Nigeria and Kenya: the Nigeria Data Protection Act 2023 and Kenya's Data Protection Act 2019 both set rules on consent and on sending personal data to other countries. GA4 sends data to Google's servers abroad, so say so in your privacy notice and check the regulators' guidance (the NDPC in Nigeria, the ODPC in Kenya).
The simplest approach that works everywhere is to ask everyone. Google's consent mode is how the tag learns the answer. It has four consent signals; a site with no advertising only ever grants one of them:
analytics_storage: analytics cookies. This is the one Ember Studio asks for.ad_storage,ad_user_data,ad_personalization: advertising cookies and data. Ember Studio runs no Google Ads, so these stay denied.
Consent mode can work in two ways. In basic mode the tag does not load at all until the visitor accepts. In advanced mode the tag loads straight away and, while consent is denied, sends "cookieless pings" that Google uses to estimate the missing visitors. Those pings can still include the browser type, screen size and IP address. Basic mode is easier to explain in a privacy notice and to defend, so Ember Studio uses it, and accepts that its reports only count visitors who said yes.
Choose how you will build the banner:
- A consent management platform (CMP) or your site builder's cookie banner. Pick one whose documentation says it supports Google consent mode. It keeps the records of consent that Google's policy asks for, which a hand-made banner does not.
- The small banner in the next step, for a hand-coded site with a modest number of EU or UK visitors, where you accept that you are not keeping a record of each choice.
Check it worked
Write down, in your site's admin notes or a shared document, which you chose (CMP or hand-made banner), that you use basic consent mode, and that only analytics_storage is ever granted. Then update your privacy notice to name Google Analytics, what it collects, that data goes to Google abroad, and how to change a cookie choice; write a privacy notice for a small business website covers the wording.
Step 4 · Add the Google tag behind a consent banner
If you use a CMP or site builder banner, follow its instructions for Google consent mode, paste your Measurement ID where it asks, set it to block the Google tag until consent, and go to the check below.
For a hand-coded site, paste this into the <head> of every page, as high as you can. Replace G-XXXXXXXXXX in the GA_ID line with your own Measurement ID. The Measurement ID is not a secret; anyone can read it in your page source.
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
// Everything denied until the visitor chooses.
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
analytics_storage: 'denied'
});
var GA_ID = 'G-XXXXXXXXXX'; // replace this with your Measurement ID
var analyticsLoaded = false;
function loadAnalytics() {
if (analyticsLoaded) return;
analyticsLoaded = true;
gtag('consent', 'update', { analytics_storage: 'granted' });
var s = document.createElement('script');
s.async = true;
s.src = 'https://www.googletagmanager.com/gtag/js?id=' + GA_ID;
document.head.appendChild(s);
gtag('js', new Date());
gtag('config', GA_ID);
}
function readChoice() {
try { return localStorage.getItem('analytics-consent'); } catch (e) { return null; }
}
function saveChoice(value) {
try { localStorage.setItem('analytics-consent', value); } catch (e) {}
}
if (readChoice() === 'granted') loadAnalytics();
</script>Then paste the banner just before </body> on every page. Both buttons are the same size and style, because refusing must be as easy as accepting:
<div id="consent-banner" role="region" aria-label="Cookie choice" hidden
style="position:fixed;left:0;right:0;bottom:0;padding:16px;background:#f1f2f4;border-top:1px solid #9ba1ac;">
<p style="margin:0 0 12px;">
We would like to use Google Analytics cookies to count visits and see which pages are useful.
Nothing is set unless you accept. <a href="/privacy">Read our privacy notice</a>.
</p>
<button type="button" id="consent-accept">Accept analytics</button>
<button type="button" id="consent-reject">Reject analytics</button>
</div>
<script>
(function () {
var banner = document.getElementById('consent-banner');
if (!readChoice()) banner.hidden = false;
document.getElementById('consent-accept').addEventListener('click', function () {
saveChoice('granted');
banner.hidden = true;
loadAnalytics();
});
document.getElementById('consent-reject').addEventListener('click', function () {
saveChoice('denied');
banner.hidden = true;
});
// Any link with data-cookie-settings reopens the banner.
document.querySelectorAll('[data-cookie-settings]').forEach(function (link) {
link.addEventListener('click', function (event) {
event.preventDefault();
if (readChoice() === 'granted') {
gtag('consent', 'update', { analytics_storage: 'denied' });
saveChoice('denied');
// Remove the _ga and _ga_<container-id> cookies already set.
var host = location.hostname;
document.cookie.split(';').forEach(function (pair) {
var name = pair.split('=')[0].trim();
if (name.indexOf('_ga') !== 0) return;
document.cookie = name + '=; Max-Age=0; path=/';
document.cookie = name + '=; Max-Age=0; path=/; domain=.' + host;
document.cookie = name + '=; Max-Age=0; path=/; domain=.' + host.replace(/^www\./, '');
});
location.reload();
return;
}
banner.hidden = false;
});
});
})();
</script>Add a way to change the choice in the footer of every page:
<a href="#" data-cookie-settings>Cookie settings</a>If someone who accepted clicks Cookie settings, the script withdraws consent, deletes the Google Analytics cookies (every cookie whose name starts with _ga) and reloads the page, so the tag no longer loads and nothing of it is left on the device. They can then accept again from the banner if they change their mind back.
The tag adds a download of its own to every page for visitors who accept. With basic consent mode, visitors who refuse (or who are on a slow prepaid mobile connection and close the banner) do not download it at all.
Check it worked
Open your site in a private browser window. The banner appears at the bottom of the page. Open the browser's developer tools (F12 on Windows, Option-Command-I on a Mac), choose the Network tab and type google in its filter box: nothing is listed. Click Accept analytics. A request to googletagmanager.com/gtag/js appears, followed by one or more requests whose names start with collect. Reload the page: the banner stays hidden. In developer tools, open the Application tab (Chrome, Edge) or Storage tab (Firefox), then Cookies: you see _ga and a _ga_ cookie ending in your container ID. Click your Cookie settings link: the page reloads, the _ga cookies have gone from the cookie list, and no new google request appears in Network. Click Cookie settings again and accept to switch analytics back on. In GA4, open Reports > Realtime; within a few minutes the Active users card shows at least 1.
Step 5 · Make a sent enquiry a key event
The number Ember Studio cares about most is enquiries. The reliable way to count them, whatever form tool you use, is a thank-you page:
- Create a page on your site at
/thanksthat says the enquiry arrived and when you will reply. Give it the same<head>code and banner as every other page. - In your form tool's settings, set it to send people to
https://emberstudio.example/thanksafter they submit. Most form tools and site builders have this setting, though some keep it for paid plans.
Now teach GA4 that a view of that page is an enquiry. In Admin, under Data display, click Events, then Create event:
- Name the event
enquiry_sent. Use lowercase letters and underscores. - Turn on Mark as key event.
- Choose Create without code.
- Set the conditions:
event_nameequalspage_view, andpage_locationcontains/thanks. - Click Create.
GA4 now creates an enquiry_sent event each time someone who accepted analytics lands on the thank-you page. Your original page view is still recorded as well.
Check it worked
In a private window, open your site, accept analytics, and send a test enquiry with "TEST" in the message (and delete it from your inbox afterwards). When you land on the thank-you page, open Reports > Realtime in GA4. Within a few minutes the Event count by event name card lists page_view and enquiry_sent, and the Key events by event name card lists enquiry_sent with a count of 1. If it has not appeared after 30 minutes, check that the page address really contains /thanks and send another test. Standard reports can take up to 24 hours to show a new key event.
Step 6 · Keep detailed data for 14 months
GA4 keeps the visitor-level data behind its explorations (the custom analysis tool) for 2 months unless you change it. The standard reports keep their totals regardless, but anything you want to explore, such as how last year's enquiries compare with this year's, needs the longer setting.
In Admin, under Data collection and modification, open Data retention. Set both Event data retention and User data retention to 14 months and click Save. Standard properties can choose 2 or 14 months; longer periods are only offered on the paid version.
Keep only what you need. Fourteen months lets you compare a month with the same month last year; mention the period in your privacy notice.
Check it worked
Leave the Data retention page and open it again. Both settings show 14 months.
Step 7 · Stop your team's visits counting
Ember Studio's designers open the portfolio pages many times a day. Those visits make popular pages look more popular and hide what clients actually read. GA4 can mark visits from your office's internet address as internal and drop them.
First find the office's public IP address. On the office network, search the web for "what is my IP address", or ask whoever looks after your internet connection.
Check that the address stays the same. Many home broadband plans, and almost every mobile data or MiFi connection in Nigeria, Kenya and elsewhere, give you a different address from time to time. IP filtering only works for a connection with a fixed (static) address. Staff who work from phones or changing connections should press Reject analytics on the banner on their own devices, which keeps them out of the data in basic consent mode.
Then create the rule:
- In Admin > Data streams, open your web stream and click Configure tag settings, then Show more, then Define internal traffic, then Create.
- Name the rule
Lagos office. Leave thetraffic_typevalue asinternal. - Under IP address, choose IP address equals and enter the office address. For a range, choose IP address is in range and enter it in CIDR form, such as
203.0.113.0/29. - Click Create. Add a rule for each office with a fixed address, such as Nairobi.
The rule only labels the traffic. A data filter removes it. In Admin, under Data collection and modification, click Data filters. GA4 often creates an Internal Traffic filter already, in the Testing state; if there is none, click Create Filter, choose Internal Traffic, name it Internal traffic, choose Exclude and set the state to Testing.
Leave it in Testing for a few days. Testing labels matching visits without removing them, so you can check the rule catches the right traffic. A filter in the Active state deletes matching data for good: Analytics never processes it, and you cannot get it back.
Check it worked
After two days, open Explore, start a Blank exploration and choose Free form. Add the dimensions Test data filter name and Event name, and the metric Event count. Put Test data filter name and Event name in Rows and Event count in Values. You see rows labelled with your filter's name, exactly as it appears in Data filters (GA4's own filter is called Internal Traffic), for visits from the office, and blank rows for everyone else. If no row shows the filter name, check the IP address and wait another day (filters can take 24 to 36 hours to start). When the labels look right, open Data filters, edit the filter, set it to Active and save; the filter list then shows it as Active.
Activate the filter after you have done your own Realtime checks. Once it is active, your test visits from the office no longer appear.
Step 8 · Read three reports each month
GA4 has dozens of reports. A small business needs three, read once a month, in the first week, for the month just ended. Click the date picker at the top right, choose the first to the last day of the month just ended on the calendar, tick Compare, choose Previous period and click Apply. Previous period means the same number of days just before your range, not the previous calendar month: November 1 to 30 is compared with October 2 to 31. That is close enough to spot a trend; for the exact previous month, use last month's row in the document you start below.
- Reports > Acquisition > Traffic acquisition. Visitors grouped by where they came from: Organic Search, Direct, Organic Social, Referral and others. Look at the Sessions and Key events columns together. A channel that brings few visitors but many enquiries deserves more of your time.
- Reports > Engagement > Pages and screens. Which pages people viewed and for how long. Check that your services and case study pages are near the top, and look for pages with many views and very short engagement time; those may not answer the question that brought people there.
- Reports > Engagement > Key events. How many
enquiry_sentevents happened. Compare it with the enquiries in your inbox. The GA4 figure is lower, because it only counts people who accepted analytics. Treat it as a trend to watch, not a total.
Open the Tech reports once a quarter to see which devices and browsers visitors use. If most of your visitors are on mobile phones, as they often are for audiences in Africa, test your pages on a low-cost Android phone over mobile data, not only on the office Wi-Fi.
Check it worked
Create a shared document called Website numbers with one row per month and four columns: sessions, top source, top page and key events. Fill in last month from the three reports (for a new property, fill in what you have so far). Add a monthly calendar reminder for the first Monday, assigned to a named person.
Next steps
Your GA4 property now counts consenting visitors, records each enquiry as a key event and ignores your own office. From here:
- Help more people find the site with the SEO basics for a small business site, then watch Organic Search in the Traffic acquisition report.
- Make sure your privacy notice matches what GA4 collects, using write a privacy notice for a small business website.
- Read understand GDPR basics for a small business to see where analytics sits in your wider data protection duties.
- If the banner and the lower counts bother you, compare privacy-friendly analytics with Plausible, which works without cookies.
Related tutorials
- Add privacy-friendly analytics to a site with PlausibleYou will add Plausible to a small business site, hosted by Plausible or self-hosted with Community Edition v3.2.2, and see your first page views and a contact form goal on the dashboard.
- Do the SEO basics for a small business siteYou will have your site verified in Google Search Console with a sitemap read successfully, a page-by-page audit sheet, and the five weakest pages fixed and sent back to Google.
- Write a privacy notice for a small business websiteYou will turn your data inventory into a plain-language privacy notice that names every tool you use, meets the transparency lists in the GDPR, Nigeria's Data Protection Act and South Africa's POPIA, and is linked from every form on your site.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials