A Guide to Setting Up Google Analytics 4 and Conversion Tracking for Business Websites
T
Kembali ke Blog

A Guide to Setting Up Google Analytics 4 and Conversion Tracking for Business Websites

Tutorial
Tim Pilar Inovasi 03 Nov 2026 6 min baca 1,264 kata 15
A practical guide to setting up Google Analytics 4 and conversion tracking: property configuration, data streams, event tracking with gtag.js and GTM, and validating conversions in GA4 Realtime.

Many clinic website, hospital, and retail business managers have installed Google Analytics 4 (GA4), but the reports generated stop only at page_view and session numbers. In fact, operational decisions—for example, whether an advertising budget of Rp15 million/month for dental services is worth continuing—require conversion data connected to revenue. Without correct conversion tracking, GA4 becomes merely a pretty dashboard with no decision value. This article discusses end-to-end 2024-version GA4 setup: from creating a property, configuring a data stream, implementing conversion events (clinic appointment booking through pharmacy POS transactions), to validation in DebugView. All steps are arranged so they can be executed directly by an internal IT team without needing an expensive consultant.

1. GA4 Property and Data Stream Configuration

Start from analytics.google.com → Admin → Create Property. Fill in the property name using a consistent format, for example RS Sehat - Production, not just Website. This name appears in all reports and will follow you for years. In the business section, select the Health category if it is a healthcare institution, and Retail for POS/pharmacy. The time zone must match the location (Asia/Jakarta, WIB), because the 24-hour data in GA4 follows this zone.

After the property is created, add two separate data streams: one for the website (https://domainklinik.com) and one for the mobile app if available. The Measurement ID is formatted as G-XXXXXXXXXX (10 characters after the G- prefix). Save this ID—it can only be seen once without having to recreate the stream. For websites with external payment systems such as Midtrans or Xendit, enable Cross-Domain Measurement and register the payment domain. Without this, the session of a user who checks out will be considered (direct) in GA4, so advertising attribution reports become biased by up to 40–60%.

Set Data Retention to 14 months (the default is only 2 months) in the Data Settings → Data Retention menu. As a consequence, PDP Law No. 27 of 2022 requires you to include a Consent Banner and enable Consent Mode v2 before data is sent. For internal traffic, filter office IPs via Admin → Data Streams → Configure Tag Settings → Define Internal Traffic, then set it to Exclude so the marketing team does not pollute the data. Also enable Enhanced Measurement for scroll, outbound click, site search, and file download—this free feature saves 8–10 manual events.

2. Conversion Tracking Implementation: gtag.js or GTM?

There are two implementation paths. Use gtag.js directly if the website is based on simple static HTML/CMS with a small dev team. Use Google Tag Manager (GTM) if the website already has 15+ events and needs control from the marketing team without redeploying. The latest GTM web container version as of 2024 supports server-side tagging to reduce data loss due to ad-blockers—but for beginners, client-side is sufficient.

Event naming convention: snake_case, maximum 40 characters, maximum 25 parameters per event, and a total of 500 unique events per property. For the Indonesian context, the recommended events are: appointment_request (polyclinic booking), whatsapp_click, phone_click, pharmacy_order (POS/pharmacy), form_konsultasi_submit. Avoid generic names such as click or submit because they are not scalable.

After the event is sent, open Admin → Events and mark events with business value as conversion (star icon). Maximum 30 conversions per property—so prioritize. Example implementation code for a clinic appointment form with gtag.js:

// Kirim event conversion saat form booking ter-submit
document.getElementById('form-appointment').addEventListener('submit', function() {
  gtag('event', 'appointment_request', {
    value: 150000,           // estimasi revenue per booking
    currency: 'IDR',
    poli: document.getElementById('poli').value,
    form_id: 'appointment-form',
    debug_mode: true         // hapus saat production
  });
});

For pharmacy/POS transactions with dynamic values, use the value, currency, and items parameters (product array). Make sure the event is sent after a successful response from the backend—not only when the button is clicked, because many forms fail server validation and produce false conversions.

3. Verification, Reporting, and Attribution

Before go-live, enable DebugView by adding ?debug_mode=1 to the URL or install the Google Analytics Debugger extension version 2.0.6 in Chrome. Open GA4 → Admin → DebugView, then submit the test form. The event will appear within 5–10 seconds with all parameters. If it does not appear, check the Network tab in DevTools: the request to google-analytics.com/g/collect must have status 204.

The main report for decision makers: Advertising → Attribution → Conversion Paths. GA4's default attribution model is data-driven—different from Universal Analytics, which last used last-click. This means channels that touch the user at the top of the funnel also receive credit. For hospitals with multiple branches, use a custom dimension named cabang (scope: event) so reports can be filtered by location. Custom dimensions in GA4 are limited to 50 per property and cannot be deleted after use—plan carefully.

If data volume >10,000 events/day, enable free BigQuery Export (quota 1 million events/day). This raw data is important for cohort analysis and reconciliation with internal SIMRS/SIM Klinik data. The daily export runs at 06:00 WIB and stores data for up to 14 months according to retention.

Best Practices

  1. Validate in staging before production. Create a separate Website - Staging data stream with a different Measurement ID. Move to production only after 3 days without errors in DebugView.
  2. Enable Consent Mode v2. Required for UU PDP compliance; use a library such as Cookiebot or Osano. GA4 will send cookieless pings for users who decline.
  3. Set explicit conversion value. Fill value with at least the estimated revenue (for example, Rp150,000 for a dental polyclinic appointment). Without value, ad ROI reports cannot be calculated.
  4. Filter bots and referral spam. Enable Known Bots and add exclusion domains (semalt, buttons-for-website) in Admin → Data Streams → Configure Tag Settings.
  5. Document the event schema. Store it in Notion/Confluence: event name, parameters, trigger, and PIC. Without documentation, events will be duplicated within 6 months.

FAQ

Is Google Analytics 4 free for commercial use?

Yes, standard GA4 is free up to 10 million hits/month. This limit is rarely reached by mid-sized Indonesian businesses. Only GA4 360 (Enterprise) is paid, starting at USD 50,000/year.

How long do conversion events take to appear in GA4 reports?

Raw events appear in Realtime within 10–30 seconds. For standard reports (Reports → Engagement → Conversions), batch processing takes 24–48 hours. Don't panic if the numbers don't appear on the same day.

Is GTM necessary if you already use gtag.js?

Not mandatory. GTM is useful if the marketing team wants to add events without redeploying through a developer. If change volume is low (<5 events/month), direct gtag.js is lighter—adding ~15 KB vs ~80 KB for a GTM container.

How do you track offline conversions such as clinic visits or POS transactions?

Use GA4 Measurement Protocol. The SIMRS/POS backend sends a POST to https://www.google-analytics.com/mp/collect?measurement_id=G-XXXX&api_secret=YYYY with the client_id parameter stored when the user logs in. Example payload: {\"client_id\":\"xxx\",\"events\":[{\"name\":\"offline_purchase\",\"params\":{\"value\":250000,\"currency\":\"IDR\"}}]}.

A proper GA4 setup is not a one-off project, but a foundation for operational decisions: how much is the cost of acquiring a new patient, which polyclinic is most profitable, and which ad channel is worth scaling. Without conversion tracking, those numbers are only assumptions. If your internal team does not yet have the capacity to design an event schema, integrate Measurement Protocol with SIMRS/SIM Klinik, or audit an existing GA4 configuration, we are ready to help—from a 1-day audit to full implementation with documentation and handover. Contact Nugroho Setiawan for a free initial consultation.

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

Terakhir diperbarui 03 Nov 2026

Komentar

Komentar ditinjau sebelum tampil.

Belum ada komentar. Jadilah yang pertama!