A Complete Guide to Setting Up Google Analytics 4 and Conversion Tracking for Businesses
Learn how to set up Google Analytics 4 (GA4) and conversion tracking in a practical way. A step-by-step guide with code examples and best practices for measuring the effectiveness of your business website.
Many businesses, including hospitals, clinics, and companies that use ERP or POS, have installed Google Analytics 4 (GA4) on their websites. However, quite a few only look at visit data without measuring conversions that actually impact revenue. In fact, GA4 has an event-based model that allows you to track specific actions such as online patient registration, ERP demo requests, or product purchases at POS. Without proper conversion tracking, you only get vanity metrics data. This article will guide you through setting up GA4 and conversion tracking practically, with code examples, technical steps, and best practices. If you are in Yogyakarta, DIY, or Magelang and need professional assistance for GA4 integration with SIMRS, SIM Klinik, ERP, POS, or your business website, our IT consulting and application development services are ready to help.
Why GA4 and Conversion Tracking Are Important for Your Business
GA4 is the latest generation of Google Analytics that replaces Universal Analytics. Unlike its predecessor, GA4 uses an event-based model, which is more flexible and privacy-friendly. Every user interaction can be tracked as an event, including page views, scrolls, button clicks, and form submissions. This is very important for businesses that have complex conversion flows, such as hospitals that offer online patient registration, or clinics that accept doctor schedule reservations. With GA4, you can send custom events that suit specific needs, for example the pendaftaran_pasien or booking_dokter event.
Conversion tracking allows you to identify events that are valuable to the business. For example, for a SIM Klinik website, the pendaftaran_pasien or booking_dokter event can be marked as a conversion. For an ERP website, the request_demo or unduh_brosur event is a conversion. By marking events as conversions, GA4 will provide more accurate attribution and enable integration with Google Ads for campaign optimization. Without conversion tracking, you will not know whether the traffic you pay for generates leads or not. As an example, a clinic in Yogyakarta recorded a conversion rate of 3.2% for online registration, while another page was only 0.8%. This data enables more precise marketing budget allocation.
In the context of healthcare services, conversion data can help measure the effectiveness of digital campaigns. GA4 also supports cross-device tracking, so patients who view the website on a phone and register on a desktop remain measurable. In addition, GA4 is integrated with the Google ecosystem such as Google Ads, Search Console, and BigQuery. For businesses with advanced analytics needs, exporting data to BigQuery allows combining GA4 data with internal SIMRS or ERP data. This opens up opportunities for deeper analysis, for example linking traffic sources with the number of actual patient visits. However, all of this depends on setting up conversion tracking correctly from the start.
Steps to Set Up GA4 and Conversion Tracking
The first step is to create a GA4 property. Go to Google Analytics, select Admin, then Create Property. Fill in the property name, time zone, and currency. After the property is created, add a data stream for your website. You will get a Measurement ID (format G-XXXXXXXXXX). Copy this ID to use in Google Tag. If you use Google Tag Manager (GTM), create a GA4 Configuration tag and enter that Measurement ID. The latest version of GTM (web container) is highly recommended for tidier tag management and reducing the risk of errors.
Install Google Tag (gtag.js) on all website pages. Place the snippet inside
or use GTM. After that, you can send custom events. Example: tracking clicks on the Book Appointment button on a clinic website. Make sure the button has a unique ID. Below is an example of JavaScript code that can be run to send an event to GA4. Note that gtag.js must already be loaded beforehand.
document.querySelector('#bookBtn').addEventListener('click', function() {
gtag('event', 'book_appointment', {
'event_category': 'engagement',
'event_label': 'appointment_form',
'value': 1,
'currency': 'IDR'
});
});
After the event is sent, you need to mark it as a conversion. In GA4, go to Admin > Events, then find the desired event (for example: book_appointment). Turn on the Mark as conversion toggle. For events that have not yet appeared, you can create a custom event through GTM or directly in GA4 (Admin > Events > Create event). Make sure you test the event using DebugView mode in GA4. Open DebugView, then perform an action on the website (click the button). The event will appear within seconds. Also use Google Tag Assistant to verify the tag.
For more complex tracking, such as form submissions that do not lead to a thank-you page, you can use the Form Submission trigger in GTM or a JavaScript event listener. Example: an online patient registration form that uses AJAX. You can send the event after a successful response. For e-commerce (retail POS), use the purchase event with the parameters items, transaction_id, value, and currency. GA4 has recommended e-commerce events, such as view_item, add_to_cart, begin_checkout, and purchase. Make sure you follow the correct parameter schema so that the data appears in the Monetization report.
Best Practices
- Use GTM for tag management: With GTM, you can add or change tags without editing website code. This reduces the risk of errors and makes team collaboration easier.
- Define conversions aligned with business goals: Do not mark every event as a conversion. Focus on events that actually generate revenue or leads, such as patient registration, demo requests, or purchases.
- Test with DebugView and Tag Assistant: Before launching a campaign, make sure every event is sent with the correct parameters. DebugView in GA4 helps you view events in real time.
- Connect GA4 with Google Ads and Search Console: This integration allows you to see conversion data in Google Ads and optimize campaigns based on organic behavior. Connect via Admin > Product Links.
- Document events and conversions: Create an internal document that lists event names, parameters, triggers, and conversions. This is important for consistency and onboarding new team members, especially if you manage a complex SIMRS or ERP.
FAQ
Is GA4 free?
Yes, GA4 has a free version with limits on the number of events and data retention of up to 14 months. For advanced needs, Google Analytics 360 offers enterprise features with a subscription fee. However, for most businesses, the free version is sufficient.
How do you track conversion in a form without a thank you page?
You can use a JavaScript event listener triggered when the form is successfully submitted, or use GTM with a Form Submission trigger combined with a success condition (for example, the appearance of a notification element). Another alternative: send an event via an AJAX callback after a successful server response.
Is it necessary to use Google Tag Manager?
It is not mandatory, but it is highly recommended. GTM makes tag management easier, reduces dependence on developers, and allows safer implementation of consent mode and third-party tags. For websites with many events, GTM is the industry standard.
How long does it take for data to appear in GA4?
Real-time data appears within seconds to minutes in the Realtime report. However, for standard reports, data can be delayed by up to 24-48 hours. If you use DebugView, events appear immediately after being sent. Make sure no filters are blocking the data.
Proper GA4 setup and conversion tracking is the foundation for data-driven decision-making. By tracking relevant conversions, you can optimize your SIMRS, SIM Klinik, ERP, POS, or business website. If you need professional assistance, Nugroho Setiawan, as an Operations Manager & Full Stack Developer, is experienced in GA4 integration with healthcare and enterprise systems. We provide IT consulting and application development services for the Yogyakarta (DIY) and Magelang, Central Java areas. Contact us for further discussion about your business digitalization needs.
This article is part of the knowledge base of Nugroho Setiawan, an IT consultant in Jogja (Yogyakarta). Related solutions: PilarPOS SIMRS (Hospital Information System) Clinic Management System. Need a free consultation?
Komentar
Belum ada komentar. Jadilah yang pertama!
Saya membantu konsultasi IT & pengembangan aplikasi untuk rumah sakit, klinik, dan bisnis di Yogyakarta (DIY), Magelang, dan sekitarnya.