Complete Guide to Setting Up Google Analytics 4 & Conversion Tracking for Your Business
T
Kembali ke Blog

Complete Guide to Setting Up Google Analytics 4 & Conversion Tracking for Your Business

Tutorial
Tim Pilar Inovasi 24 Aug 2026 18 min baca 4,019 kata 266
Maximizing digital data is crucial. This article guides you through setting up Google Analytics 4 (GA4) and configuring conversion tracking, essential for measuring performance and optimizing your business's digital strategy, from clinics to ERP systems.

In this competitive digital era, every interaction on online platforms – from clinic website visits, patient registration through portals, to downloading SIMRS service brochures – is valuable data. However, many organizations, including hospitals and clinics, are still grappling with challenges in measuring the effectiveness of their digital assets. They struggle to identify the Return on Investment (ROI) of digital campaigns or understand the user journey holistically, often because data is scattered or analytics tools are inadequate. The transition from Universal Analytics (UA) to event-based Google Analytics 4 (GA4) presents both opportunities and new challenges. Without a strong data foundation, operational and strategic decisions can become speculative. This article serves as a practical and in-depth guide. We will guide you through every important step, from initial preparation, GA4 property setup, integration with Google Tag Manager (GTM) version 2, to precise conversion tracking configuration. Our goal is to equip you with knowledge and concrete examples so you can build an accurate data analysis system, enabling you to optimize your digital strategy and drive measurable business growth.

Fundamentals of Google Analytics 4 and the Event-Based Data Model

Google Analytics 4 (GA4) marks a significant paradigm shift from Universal Analytics (UA) with the adoption of a fully event-based data model, no longer session-based. This is a fundamental change that provides much greater flexibility in measuring complex user interactions across various platforms, from websites to mobile apps. In GA4, every user interaction—from loading a page, clicking a button, to watching a video—is considered an 'event'. This approach enables more detailed analysis of how users interact with your digital properties.

There are four main categories of events in GA4 that you need to understand. First, automatically collected events, such as session_start, first_visit, and user_engagement, which are automatically collected by GA4 without additional configuration. Second, enhanced measurement events, which can be easily enabled in the GA4 data stream settings. These include events such as scroll, outbound_click, site_search, video_start, and file_download. For example, for a clinic, tracking file_download for service brochures or health guides is an important insight into the interest of potential patients.

Third, recommended events are events suggested by Google for specific industries or use cases, such as generate_lead, purchase, or add_to_cart. Although not automatic, Google provides recommended parameters for these events, ensuring data consistency. For example, for a patient registration portal, the appointment_booked event with parameters such as appointment_id, service_name, and value would be very informative. Finally, custom events are events that you fully define yourself to track interactions that are very specific and unique to your business, such as simrs_demo_request or patient_portal_login. This provides complete freedom to capture interaction nuances not covered by other categories.

The importance of parameters in each event cannot be overstated. Parameters are additional details that provide context to the event. For example, the form_submit event would be more informative if accompanied by parameters form_name (e.g., 'Patient Registration Form'), form_id (e.g., 'reg-001'), and status (e.g., 'success'). For e-commerce events, parameters such as item_id, item_name, price, and currency are crucial. This event-based data model allows GA4 to provide a more accurate picture of the user journey, from initial awareness to conversion, even across devices and sessions. It is also designed to be more resilient in the era without third-party cookies, using machine learning to model data that may be missing, providing more complete and reliable insights.

Steps to Set Up a New Google Analytics 4 Property

Getting started with Google Analytics 4 (GA4) requires a series of structured steps, especially if you do not yet have an active GA4 property. This process focuses on creating a property, configuring a data stream, and integrating with Google Tag Manager (GTM) version 2 for efficient tag management. Before starting, make sure you have a Google account and administrative access to your website.

Step 1: Create a New GA4 Property. First, log in to your Google Analytics account. In the bottom left, click 'Admin'. In the 'Property' column, click 'Create Property'. Name your property (e.g., 'Sehat Clinic Website'), select the relevant time zone and currency (e.g., 'Indonesia' and 'IDR'). Continue to fill in basic business information, then click 'Create'. After the property is created, you will be asked to choose a data stream platform. Select 'Web'. Enter your website URL (e.g., https://www.kliniksehat.com) and provide a name for the data stream (e.g., 'Clinic Website'). After that, you will get a 'Measurement ID' that starts with 'G-XXXXXXXXX'. Note this ID, as it will be used in your GTM configuration.

Step 2: Integration with Google Tag Manager (GTM). If your website is not yet integrated with GTM, this is a crucial step. GTM allows you to manage all tracking tags (including GA4) from a single interface without needing to modify the website code directly. To install GTM, create a GTM account, get the GTM container code (consisting of two JavaScript snippets), and paste the first snippet inside the <head> tag of your website, and the second snippet right after the opening <body> tag. Once GTM is installed, open your GTM container. Create a new tag with the type 'Google Analytics: GA4 Configuration'. Enter the Measurement ID (G-XXXXXXXXX) you noted earlier. Make sure the option 'Send a page view event when this configuration loads' is enabled. As the trigger, select 'All Pages'. Publish your GTM container to apply the changes to the website.

Step 3: Verify GA4 Installation. After GTM is published, it is very important to verify that GA4 has been installed correctly and has started collecting data. Open your website, then in your GA4 property, navigate to 'Admin' > 'DebugView'. You will see events coming in in real-time. If you do not see data, recheck your GTM installation and GA4 tag configuration. You can also use the Chrome extension 'Google Tag Assistant Companion' (make sure it is the latest version) to check the active GA4 tags on each page of your website. This extension will show whether the GA4 tag has been activated correctly and what data is being sent.

Step 4: Configure Enhanced Measurement. GA4 offers the 'Enhanced Measurement' feature that automatically tracks various important interactions without the need for additional GTM configuration. This includes scrolls, outbound clicks, site search, video engagement, and file downloads. To enable it, in your GA4 property, navigate to 'Admin' > 'Data Streams', click your web data stream. Under 'Enhanced measurement', make sure the toggle is on. You can also click the gear icon to configure which events you want to track or disable. This feature is very useful for getting basic insights into user behavior quickly and efficiently, before you get into more specific conversion tracking.

Implementing Conversion Tracking Using Google Tag Manager

Once GA4 and GTM are installed, the next step is to implement conversion tracking, the core of digital performance analysis. A conversion is a valuable action taken by a user on your website, such as new patient registration, requesting a SIMRS demo, downloading a health guide e-book, or filling out a service contact form. Identifying and tracking these conversions is very important for measuring the ROI of digital campaigns and optimizing business strategy.

Step 1: Create Variables in GTM. Variables in GTM are used to capture dynamic information from the website. For example, you might want to capture the text of a clicked button, the destination URL, or the value from a form. For conversions such as WhatsApp button clicks, you can create a 'Click Text' or 'Click URL' variable. If the conversion involves a form, you may need a 'DOM Element' variable to retrieve text from a specific HTML element after submission, or a 'Data Layer' variable if your website pushes data dynamically to the Data Layer.

Step 2: Create Custom Triggers in GTM. Triggers determine when a tag should be activated. For conversion tracking, you will often use custom triggers. A popular example is the 'Click - All Elements' trigger with specific conditions. For example, to track WhatsApp button clicks, you can create a trigger that activates when 'Click URL' contains whatsapp.com/send, or 'Click Element' matches a CSS Selector such as a.btn-whatsapp. For forms, you can use a 'Form Submission' trigger (if the form uses standard submit) or a 'Custom Event' if you push an event to the Data Layer manually after the form is successfully submitted via AJAX. For example, after patient registration succeeds, your website might push the form_submission_success event to the Data Layer.

Step 3: Create a GA4 Event Tag in GTM. Once the variables and triggers are ready, you can create a GA4 event tag. Create a new tag with the type 'Google Analytics: GA4 Event'. In the 'Configuration Tag' field, select the GA4 configuration tag you created earlier. Give the event a clear and descriptive name (for example, generate_lead, form_submit_pasien, whatsapp_contact). This event name will appear in your GA4 reports. Add 'Event Parameters' to provide further context. For example, for the generate_lead event, you can add a form_name parameter with the value 'Patient Registration Form' and value with the estimated conversion value. Finally, associate this tag with the custom trigger you created in Step 2.

Here is an example of JavaScript code you can use to push a custom event to the GTM Data Layer, which can then be captured by a GTM trigger:

// Example to send a custom event after the registration form succeeds
// It is assumed this runs after the AJAX process succeeds or on the thank-you page
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'form_submission_success',
form_name: 'Pendaftaran Pasien Online',
form_id: 'reg-001',
user_id: 'UID12345', // If the user is logged in and available
value: 250000, // Estimated conversion value in IDR
currency: 'IDR'
});

Explanation: This JavaScript code is designed to be pushed to the GTM Data Layer after a patient registration form is successfully submitted, for example on a 'Thank You' page or after a successful AJAX response. This form_submission_success event carries important parameters such as the form name, form ID, registered user ID (if any), estimated conversion value, and currency. With this, you can create a GTM trigger of type 'Custom Event' that listens for the form_submission_success event, then send this data as a context-rich GA4 event to your property.

Another example, to track clicks on a WhatsApp link, you can use a Custom HTML Tag in GTM:

<script>
document.addEventListener('DOMContentLoaded', function() {
var whatsappLinks = document.querySelectorAll('a[href*="whatsapp.com/send"]');
whatsappLinks.forEach(function(link) {
link.addEventListener('click', function() {
window.dataLayer.push({
event: 'whatsapp_click',
link_url: this.href,
link_text: this.innerText || (this.querySelector('img') ? 'WhatsApp Icon' : 'Link')
});
});
});
});
</script>

Explanation: This script, placed in a Custom HTML Tag in GTM with the 'All Pages - DOM Ready' trigger, will detect any click on a link whose URL contains whatsapp.com/send. When a click is detected, the custom event whatsapp_click will be pushed to the Data Layer, carrying the URL and link text information. This is very effective for measuring direct interactions with the support team or registration via WhatsApp, which is often an important conversion path for service businesses.

Step 4: Mark the Event as a Conversion in GA4. After the event is successfully sent to GA4 via GTM, you need to tell GA4 that the event is a conversion. In your GA4 interface, navigate to 'Configure' > 'Events'. You will see a list of all events that have been collected. Find the name of the event you just created (for example, form_submission_success or whatsapp_click). Turn on the 'Mark as conversion' toggle next to that event. Within a few hours, or at most 24-48 hours, conversion data will begin to appear in your 'Conversions' report, providing insight into your digital performance.

Debugging and Validating GA4 Data

Data accuracy is the foundation of every good business decision. In the context of Google Analytics 4, incorrect or incomplete data can lead to misguided strategies and wasted resources. Therefore, the process of debugging and validating GA4 data is a crucial stage that must not be overlooked after implementing conversion tracking. The goal is to ensure that every event and parameter sent to GA4 matches what is expected.

One of the main tools for debugging is GA4 DebugView. To use it, navigate to 'Admin' > 'DebugView' in your GA4 property. To enable debug mode, you can add the parameter ?_dbg=1 to your website URL while browsing, or use the Chrome extension 'Google Tag Assistant Companion' (make sure it is version 2.0.1 or later) which automatically enables debug mode. In DebugView, you will see incoming events in real time, complete with all the parameters that accompany them. This allows you to check whether the event name is correct, whether the expected parameters (for example form_name, value, currency) have been sent, and whether the values are accurate. You can click each event to see its full details.

In addition to DebugView, Google Tag Assistant Companion is a very useful Chrome browser extension. This extension allows you to see which Google tags (GA4, GTM, Google Ads) are active on any page, as well as any errors that may occur. It provides a direct view of what is happening at the technical layer. For more in-depth checks, Browser Console (Developer Tools) is your best friend. By opening Developer Tools (usually with F12), you can check the 'Network' tab to see requests sent to Google Analytics (looking for 'collect' or 'g/collect'), inspect the Data Layer (by typing dataLayer in the console) to see pushed events, and detect any JavaScript errors that may be hindering data transmission.

The following is an example of a realistic GA4 event payload, which might be sent from your website after a patient registration conversion:

{
"client_id": "123456789.987654321",
"user_id": "patient_id_from_simrs_if_available",
"timestamp_micros": "1678886400000000",
"events": [
{
"name": "generate_lead",
"params": {
"engagement_time_msec": "1000",
"session_id": "1678886300",
"session_number": "5",
"page_location": "https://www.example.com/pendaftaran-pasien-berhasil",
"page_referrer": "https://www.example.com/layanan-poli-umum",
"form_name": "New Patient Registration Form",
"form_id": "FORM_REG_001",
"lead_source": "Website Direct",
"value": 150000.00,
"currency": "IDR",
"item_list_name": "Medical Services",
"items": [
{
"item_id": "SVC001",
"item_name": "General Clinic",
"item_category": "Health Services",
"price": 100000.00,
"quantity": 1
},
{
"item_id": "SVC002",
"item_name": "Complete Blood Test",
"item_category": "Laboratory",
"price": 50000.00,
"quantity": 1
}
]
}
}
]
}

Explanation: This JSON payload represents a generate_lead event sent to GA4, likely via Measurement Protocol or GTM. This data includes client_id for unique user identification, user_id if the user is authenticated (for example, after logging into the patient portal), timestamp, and event details rich in context. Parameters such as form_name, lead_source, value, and items (which detail the services of interest) provide a complete picture of the conversion, enabling in-depth analysis of what drives patient registration.

A common error message during GA4 implementation is:

"Error: Invalid event parameter 'value'. Expected a number, but received 'Rp50.000'."

Explanation: This error indicates that the value parameter in the GA4 event, which should be a pure numeric number, instead received a string value containing non-numeric characters (for example, 'Rp' and a period). GA4 requires clean numeric values so they can be calculated and analyzed as monetary metrics. This error often occurs when the value is taken directly from user input or a DOM element that includes a currency symbol or thousands separator.

Handling: To resolve this error, you must check the GTM implementation or the JavaScript code that sends the event. Make sure that the value for the value parameter has been processed into a pure numeric format before being sent to the Data Layer or directly to GA4. You can use JavaScript functions such as parseFloat() or parseInt() to convert a string into a number. For example, if you take the value from a text element, use: parseFloat('Rp50.000'.replace(/[^0-9,-]+/g, "").replace(',', '.')) to get 50000. Also make sure that no non-numeric characters remain, such as currency symbols or thousands separators, which can interfere with conversion to a number.

Best Practices for GA4 Implementation and Conversion Tracking

  1. Use Google Tag Manager (GTM) Optimally for All Implementations: GTM is a very powerful tool for managing all your tracking tags. By implementing all GA4 events and conversion tracking through GTM (version 2.0 and above), you will separate the tracking logic from the website's core code. This simplifies deployment, modification, and debugging without the need for repeated intervention from the developer team, and reduces the risk of errors in production code.
  2. Plan the Event and Parameter Structure Carefully: Before you start implementing events, create clear documentation of which events will be tracked, the event names, and the parameters that will accompany them. Involve the operations, marketing, and IT teams in this process to ensure the data collected is relevant to your business and operational goals, for example to measure the effectiveness of online patient registration or SIMRS demo requests.
  3. Prioritize Events Relevant to Business Goals: Focus your tracking efforts on micro and macro conversions that directly contribute to your business goals. Avoid tracking too many events that do not provide actionable insights. For example, for a clinic, events such as 'appointment_registration', 'download_service_brochure', or 'click_emergency_phone' are far more important than just 'scroll_depth' that is not tied to a specific goal.
  4. Utilize User-ID for Understanding Cross-Device User Journeys: If your website or application allows users to log in (for example, a patient portal), implement user_id. With user_id, GA4 can identify the same user across different devices and sessions, providing a holistic view of the user journey from start to conversion. This is very valuable for services that involve multiple digital touchpoints.
  5. Conduct Data Audits Regularly and Consistently: Data is an asset. Conduct GA4 data audits routinely, at least every quarter, to ensure the accuracy and consistency of incoming data. Use DebugView and standard reports to verify that events are triggered correctly, parameters have appropriate values, and there is no data duplication. Small errors in configuration can accumulate into major problems in analysis.
  6. Integrate GA4 with Other Platforms Such as Google Ads and CRM: Maximize the value of GA4 data by integrating it with other platforms. Integration with Google Ads allows you to import GA4 conversions for smarter campaign optimization. Also consider exporting conversion data or important events to your CRM or SIMRS system to get a 360-degree view of the customer or patient, connecting online behavior with offline data.
  7. Understand and Comply with Data Privacy Policies: Always ensure your GA4 implementation complies with applicable data privacy regulations, whether it is GDPR, CCPA, or regulations in Indonesia such as PP 71/2019 concerning the Implementation of Electronic Systems and Transactions. Ensure you have a functioning cookie consent mechanism (consent management platform) and that the data collected complies with users' privacy preferences. Use Google Consent Mode to adjust tag behavior based on user consent status.
  8. Utilize GA4 Audiences for Effective Retargeting: GA4 allows you to build custom audiences based on very specific user behavior (for example, 'users who viewed the Cardiology Service page but have not yet registered'). These audiences can then be exported to Google Ads for highly targeted retargeting campaigns, improving your advertising effectiveness and ROI.
  9. Explore Custom Reports and Export Data to BigQuery: Do not be fixated only on standard GA4 reports. Utilize the 'Explorations' feature to create custom reports that answer your specific business questions. For more advanced and in-depth analysis, take advantage of GA4's free integration with BigQuery (for certain data volumes). This allows you to run complex SQL queries on raw GA4 data, opening up broader insight opportunities.

FAQ About Google Analytics 4 and Conversion Tracking

Q1: What is the main difference between GA4 and Universal Analytics that has the most impact on my business?

A1: The most fundamental and impactful difference is the data model. Universal Analytics (UA) is session-centric, while GA4 is entirely event-based. This means every user interaction on your website or application, from page views to button clicks or downloads, is recorded as an 'event'. As a result, GA4 provides superior flexibility for understanding user journeys across platforms and devices, tracking more complex conversions, and is better prepared for a future without third-party cookies by using machine learning-based data modeling. This allows you to gain more accurate insights into the behavior of your patients or clients.

Q2: Can I still use Universal Analytics after installing GA4?

A2: Yes, you can run Universal Analytics (UA) and GA4 simultaneously, known as 'dual tagging'. However, it is important to note that Universal Analytics has stopped processing new data since July 1, 2023. You can still access historical data in UA for a while, but all new data must be collected in GA4. It is highly recommended to switch immediately and collect data in GA4 as soon as possible to build a relevant data history.

Q3: How do I track offline conversions or those from internal systems (SIMRS/CRM) in GA4?

A3: You can track offline conversions or events from your internal systems (such as SIMRS, CRM, or ERP) in GA4 using the GA4 Measurement Protocol. The Measurement Protocol is an API that allows you to send events directly to the GA4 server from any environment that can make HTTP requests. This is very useful for attributing offline actions (for example, a patient who comes to the clinic after registering online) to a user's session on the website. The key to success is sending the appropriate client_id or user_id to connect online and offline data.

Q4: Does GA4 require cookie consent from users?

A4: Yes, like Universal Analytics, Google Analytics 4 also collects user data and therefore requires consent in accordance with applicable data privacy regulations, such as GDPR in Europe, CCPA in California, or regulations in Indonesia such as PP 71/2019 concerning the Implementation of Electronic Systems and Transactions. You must ensure that your website has a clear and functional cookie banner or consent mechanism. It is also important to integrate your GA4 implementation with Google Consent Mode to adjust tag behavior based on the user's consent status.

Q5: How long does it take to see conversion data in GA4 reports after setup?

A5: After you successfully implement conversion events via GTM and mark them as conversions in the GA4 interface, data usually starts appearing in the 'Conversions' report within a few hours. However, it sometimes takes up to 24-48 hours for data to be fully processed and appear in all standard reports. For instant verification, you can always use 'DebugView' in GA4 to see conversion events in real time immediately after you trigger the action on the website.

Q6: How can I ensure that the data I see in GA4 is accurate and not duplicated?

A6: To ensure accuracy and avoid data duplication, perform thorough testing using 'DebugView' and 'Google Tag Assistant Companion'. Check whether each event is triggered only once per user interaction. Use consistent event and parameter naming that complies with your documentation. Conduct regular data audits, at least monthly, to identify anomalies or discrepancies. Also make sure there are no tag conflicts in GTM that might cause events to trigger more than once or with incorrect parameters.

Proper Google Analytics 4 implementation is not just a technical necessity, but a strategic investment for the future of your business. With its event-based data model and in-depth conversion tracking capabilities, GA4 empowers you to understand every nuance of user interaction on your digital assets. For hospital operations managers, clinic owners, or decision-makers managing systems such as SIMRS, SIM Klinik, or ERP, accurate data from GA4 is a compass that guides smarter decisions, service optimization, and increased efficiency. Don't let your data go to waste. Immediately implement GA4 and configure your conversion tracking. If you need professional assistance in navigating this complexity, from system integration to custom web solution development, our team is ready to provide expert consultation and support. With a solid data foundation, you can turn insights into real action, driving sustainable growth and innovation for your organization.

Related solutions by PT Pilar Inovasi Informatika (Pilar Inovasi IT products): SIMRS (Hospital Information System) Clinic Management System. Need a free consultation?

Terakhir diperbarui 30 Oct 2026

Komentar

Komentar ditinjau sebelum tampil.

Belum ada komentar. Jadilah yang pertama!