How to Set Up and Optimize Google Analytics for Your Site
Start by creating a Google Analytics 4 property so you can track visits right away. Sign into your Google account, go to the Analytics dashboard, and select Admin. Under Account and Property, click Create Property, name it after your site, pick the time zone, and choose your industry. This gets a data stream running within minutes.
Installing the Tracking Code
Copy the measurement ID from the data stream settings. Paste it into your site’s head section or use Google Tag Manager if you already run that. Test the install by visiting your homepage and checking the real-time report. You should see your own visit appear within thirty seconds.
- WordPress users add the ID through a plugin like Site Kit.
- Static HTML sites place the script before the closing head tag.
- Confirm nothing blocks the request, such as an ad blocker during your own test.
Adjusting Settings for Cleaner Numbers
Exclude your own office IP addresses so staff activity does not skew session counts or conversion rates. Go to Admin, Data Streams, then Configure tag settings and add internal traffic rules. Name the filter clearly, such as Office LAN, and test it by visiting from that network.
| Filter Type | Example Use | Effect on Reports |
|---|---|---|
| Internal traffic | Block 192.168.1.0/24 | Removes 40 staff visits daily from a 2,000-visit site |
| Hostname | Keep only example.com | Stops spam referral data from inflating sessions |
Turn on enhanced measurement in the same menu so scrolls, outbound clicks, and video starts record without extra code. Check the events report after a week and remove any automatic events that never fire on your pages. This keeps your custom events list short and focused on actions that actually matter for your goals.