Why is Google Analytics 4 different from previous versions?
If you've worked with Universal Analytics before, the first thing that probably catches your attention in Google Analytics 4 (GA4) is the absence of the traditional "session" concept and the emphasis on "events." In GA4, almost everything is defined based on events—from page views to button clicks or form submissions. This fundamental change means you need to shift your mindset from "how many people came?" to "what actions did they take?"
In this article, we aim to walk through a practical and straightforward path for setting up Google Analytics 4: from creating a Property to defining key events and finally building reports that are genuinely useful for your daily decisions. If your website runs on ServerNet shared hosting or cloud servers, don't worry; the installation steps are the same in both cases, and you only need access to your site's code.
Step One: Creating a Property in GA4
To get started, go to analytics.google.com and log in with your Google account. If you've already created a Property, click the gear icon (Admin) in the bottom-left corner, then select Create Property.
In the Property creation form, enter the following details accurately:
- Property name: A name that is meaningful to you, such as "My Online Store" or "Educational Blog."
- Reporting time zone: Select Iran's time zone (Tehran) so that daily data is rolled up based on your local time.
- Currency: If you have a store, select Rial or Toman.
After creating the Property, GA4 will provide you with a Measurement ID in the format G-XXXXXXXXXX. Copy this ID; you'll need it in the next step.
Difference Between Measurement ID and Old Tracking ID
In the old version, the tracking ID started with UA- and a separate JavaScript code was generated for each website. In GA4, the ID starts with G- and the installation code is much simpler. If you still have the old code on your site, be sure to remove it to avoid double-counting data.
Step Two: Installing the Tracking Code on Your Site
After creating the Property, you need to place the tracking code on all pages of your site. The simplest method is to add the code to the <head> section of your site's template. The main GA4 code looks like this:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Replace G-XXXXXXXXXX with your own ID. If your site is WordPress-based, you can use plugins like Site Kit by Google or GA4 to simplify the installation. However, if you have a custom template or use a proprietary content management system, place the above code directly in your template file.
Verifying Installation with Real-Time Report
After placing the code, go to Reports > Realtime in GA4. If the code is installed correctly, your visit will be displayed instantly. If you don't see any data, check the following:
- Search for the code in your browser using Developer Tools (F12 key) and the Network tab; you should see a request sent to
gtag.js. - Make sure the code is on all pages of your site, not just the homepage.
- If you use a caching plugin, clear the cache and test again.
Step Three: Defining Key Events
In GA4, events are divided into two categories: automatic events (such as page_view and session_start) and manual events that you define. To have useful data, you need to identify the important events for your business. These events were called "Conversions" in previous versions and are now called "Key Events."
A Few Examples of Key Events for Iranian Websites
- Contact form submission: When a user fills out the "Contact Us" form.
- Click on the purchase button: For online stores.
- Viewing the pricing page: For service-based websites.
- Newsletter sign-up: For blogs and media outlets.
To define a manual event, you have two options: using Google Tag Manager or adding code directly to your site. The simplest way to start is using direct code. For example, to track a click on a button with the ID contact-submit, add this code to your page:
<script>
document.getElementById('contact-submit').addEventListener('click', function() {
gtag('event', 'form_submit', {
'event_category': 'engagement',
'event_label': 'contact_form'
});
});
</script>
After doing this, go to Admin > Key Events and click New Key Event. Enter the event name exactly as written in the code (e.g., form_submit) and save it. Note that event names in GA4 are case-sensitive, so make sure they match exactly.
Common Mistake: Defining Events Without Testing
One of the most common mistakes is defining an event in the GA4 panel without having the code placed on the site. The result is that the event is defined but no data is collected. Always place the code on your site before defining the event in the panel, and test it using the DebugView tool in GA4 (via Admin > DebugView) to ensure the event is being sent correctly.
Step Four: Building Practical Reports
GA4's default reports (Life Cycle and User) provide basic information, but to make real decisions, you need to build custom reports. In GA4, you can design your own reports using the Explore section.
Three Essential Reports You Should Build
1. Funnel Exploration Report: If you have a store, this report shows where users drop off in the purchase process. Define the steps in order: product view, add to cart, initiate checkout, complete purchase. With this report, you'll understand where the main problem lies; for example, if 80% of users drop off at the "initiate checkout" step, the issue is likely with the payment gateway or the checkout form.
2. Path Exploration Report: This report shows the path users take through your site. For example, you can see where users who enter from the homepage go next. This information is very useful for optimizing menu structure and internal links.
3. Page Performance Report: In this report, you can see the performance of each page based on metrics such as Engagement Time and the number of events. Unlike the old version where Bounce Rate was the primary metric, in GA4 the Engagement Rate metric is more important—meaning the percentage of sessions where the user interacted with the site for at least 10 seconds or performed an event.
Important Note About Metrics
In GA4, the Bounce Rate metric still exists, but its definition has changed. The bounce rate in GA4 is the percentage of sessions that had no interactive events. If your site has long-form content that users read without clicking anything, you might have a high bounce rate even if the content is useful. For this reason, instead of focusing on bounce rate, focus on Engagement Rate and Average Engagement Time.
Step Five: Filtering Internal Traffic
One common problem in data analysis is having your statistics polluted by your own or your colleagues' visits. To solve this, you need to filter internal traffic. In GA4, this is done through Data Filters.
First, you need to define a User Property called developer or internal and set its value to true for your own browser. You can do this by adding the following code to your site:
gtag('set', 'user_properties', {
'internal_traffic': 'true'
});
Then, in Admin > Data Filters, create a new filter, name it "Internal Traffic," select the type Internal traffic, and match the internal_traffic parameter with the value true. Finally, set the filter to Testing mode, and after a few days when you're confident it's working correctly, change it to Active.
Common Mistake: Filtering Historical Data
GA4 filters only apply to new data and do not change past data. So if you activate the filter now, data from previous months will still be polluted with internal traffic. To avoid this issue, it's better to activate the filter from the very beginning or at least consider the start date of your analysis as the time the filter was activated.
Summary and Next Steps
Setting up Google Analytics 4 isn't difficult, but it requires attention to detail. Here's a summary of the steps:
- Create a Property and copy the Measurement ID.
- Place the tracking code on all pages of your site and test it with Realtime.
- Define your business's key events and implement them on your site.
- Build custom reports in the Explore section.
- Filter internal traffic to keep your data clean.
After these steps, I recommend establishing a regular schedule for reviewing your data weekly. For example, every Monday morning, check the funnel report and content performance, and note any changes. This simple habit will help you use Google Analytics as a tool for continuous improvement rather than just accumulating raw data.
If your website is hosted on ServerNet's cloud infrastructure or shared hosting and you need help installing the code or troubleshooting potential errors, our technical support team can assist you along the way. But the key point is that data analysis is a gradual process; the more you work with GA4, the better insight you'll gain into user behavior and the better decisions you'll make for growing your business.
Comments 0
No comments yet — be the first!