Hardt Web Development  ·  SOP Library

Google Analytics 4
Setup & Configuration

SOP refHWD-SOP-GA4
CategoryClient delivery
Applies toEvery new build. GA4 must be configured before staging review.
Time30–45 minutes per site
Prepared byCharles Hardt  ·  charleshardt.com
00

Overview

GA4 is required on every site. It is the primary data source for the 30-day post-launch check-in and the Premium maintenance analytics report.

Google Analytics 4 replaced Universal Analytics in July 2023. Every new WordPress site must use GA4 — there is no Universal Analytics option anymore. GA4 uses an event-based data model rather than a session-based model, which means conversion tracking is configured differently than in UA.

Account ownership: GA4 should be created under the client's Google account, not yours. Your Google account can be added as an Editor or Administrator. If the client does not have a Google account, help them create one during onboarding and use it for GA4, Search Console, and Google Business Profile.

01

Create the GA4 property

One property per website. Create it in the client's Google account.

1
Create the account and property
Log into analytics.google.com with the client's Google account. If they already have an Analytics account, go to Admin → + Create → Property. If this is their first time, create a new account first.

Property name: use the practice or organisation name (e.g. "Norfolk Spine & Rehab")
Reporting timezone: America/New_York (Eastern Time)
Currency: US Dollar

After creating the property, GA4 will walk you through creating a Web data stream.
2
Create the web data stream
In the data stream setup:

Platform: Web
Website URL: enter the live domain (https://theirdomain.com) — not the staging URL
Stream name: same as the property name

After creating the stream, GA4 provides the Measurement ID (format: G-XXXXXXXXXX). Copy this — it is used in the next section to install the tracking tag.
3
Configure data retention
GA4 Admin → Data Settings → Data Retention. Change event data retention from the default 2 months to 14 months. This is a small setting that is easy to miss and frustrating to discover too late — at 2 months retention you cannot do year-over-year comparisons.

Click Save. This takes effect immediately for new data going forward.

02

Install the tracking tag

Use the Site Kit by Google plugin. It is the cleanest method for WordPress.

Site Kit by Google (recommended)
Install and activate the Site Kit by Google plugin (free, from Google). Go to Site Kit → Get started → sign in with the client's Google account → connect GA4.

Site Kit installs the GA4 tag automatically, connects Search Console, and provides a unified dashboard inside wp-admin showing both Analytics and Search Console data. This is the cleanest single-step method.

Note on Site Kit and Cloudflare: Site Kit places the GA4 tag in the page head via WordPress action hooks. This is compatible with Cloudflare's proxy — no additional configuration needed.
2
Alternative: WP code snippet (if not using Site Kit)
If Site Kit conflicts with another plugin or you prefer not to install it, use the WPCode plugin (formerly Insert Headers and Footers) to add the GA4 Global Site Tag manually:

<!-- 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 the Measurement ID from the data stream. Insert in the <head> section.

03

Conversion event configuration

GA4 tracks page views automatically. Conversions require additional configuration.

1
Mark form submissions as conversions
GA4 automatically tracks form_submit events if the form uses standard HTML form elements. To mark these as conversions:

GA4 Admin → Events. Find "form_submit" in the events list (may take 24–48 hours to appear after first submission). Click the toggle to mark it as a conversion.

If using Contact Form 7 or WPForms, install the CF7 / WPForms GA4 integration add-on or use WPCode to fire a custom gtag event on form submission. Test by submitting the form and checking GA4 Realtime.
2
Track booking link clicks
For medical and alt health clients with booking tool embeds, track booking button clicks as conversions. The most reliable method is to add a custom event trigger using WPCode:

// Fire GA4 event when booking button is clicked document.querySelectorAll('a[href*="jane.app"], a[href*="vagaro"], a[href*="acuity"]') .forEach(function(el) { el.addEventListener('click', function() { gtag('event', 'booking_click', { 'event_category': 'conversion', 'event_label': el.href }); }); });
Add this in WPCode as a JavaScript snippet scoped to the footer. Then mark "booking_click" as a conversion in GA4 Admin → Events.
3
Track donation form completions (nonprofit)
GiveWP fires a donation_received event on successful donations. Connect GiveWP to GA4 via the GiveWP Google Analytics add-on (included in GiveWP Plus and above) or the free Google Analytics + GiveWP community integration.

Once connected, mark the "give_donation_complete" event as a conversion in GA4. This gives you a direct revenue attribution view for the client's donation campaigns.
4
Set up phone call tracking (optional)
For medical clients where phone calls are the primary conversion, track phone number click events. Add this to WPCode (JavaScript, footer):

document.querySelectorAll('a[href^="tel:"]') .forEach(function(el) { el.addEventListener('click', function() { gtag('event', 'phone_call_click', { 'event_category': 'conversion' }); }); });
Mark "phone_call_click" as a conversion in GA4.

04

Client access

The client must have their own access to their data. You are not a gatekeeper.

Since the GA4 property is created in the client's Google account, they already have Owner access. Your job is to ensure they know how to log in and read basic reports. Add yourself as an Editor or Administrator so you can access data for the 30-day check-in and Premium maintenance reports.

1
Add yourself to the property
GA4 Admin → Property → Property access management → + → Add users. Enter your Google email. Role: Administrator (allows you to view and configure). Click Add.

Document your access level in the client's Notion project row.
2
Show the client three things at handoff
At the handoff call or in the handoff document, point the client to three reports in GA4 they should check monthly:

1. Realtime — see who is on the site right now
2. Reports → Acquisition → Traffic acquisition — where visitors come from
3. Reports → Engagement → Pages and screens — which pages are most visited

Most clients will never go deeper than these three views. Keep the handoff instructions simple.

05

Verification

Confirm tracking is firing before the site goes live.

Verify GA4 is tracking correctly on staging before launch. Do not wait until after DNS transfer to discover the tag is missing or misconfigured.

1
Realtime verification
Open the staging site in one browser tab. Open GA4 → Realtime in another tab. Navigate to several pages on the staging site. Confirm your session appears in the Realtime report. You should see page views firing for each page you visit.
2
Conversion event verification
Submit the contact form on staging. Check GA4 Realtime → Event count by event name. Confirm "form_submit" or your custom event appears within 30 seconds of submission. Click a phone number or booking button and confirm the corresponding event fires in Realtime.

06

Privacy & HIPAA considerations

GA4 and HIPAA require careful configuration for medical clients.

GA4 does not qualify as a HIPAA Business Associate and Google does not sign BAAs for standard GA4 accounts. For medical covered entities, GA4 must be configured to avoid transmitting Protected Health Information (PHI) to Google.

Do not track PHI in GA4 events
Never pass patient-identifiable data (name, email, condition, appointment type) in GA4 event parameters. The custom events in this SOP (form_submit, booking_click, phone_call_click) track user behaviour without personal data — they are safe.

If a client asks to track which specific services a user viewed before booking, this is safe. If they ask to track the specific medical condition a user searched for, this is PHI territory and should not be passed to GA4.
Enable IP anonymisation (if required)
GA4 anonymises IP addresses by default since 2022. No additional configuration is required for IP anonymisation.

However, for medical clients who have heightened compliance concerns, add this parameter to the GA4 config call:

gtag('config', 'G-XXXXXXXXXX', { 'anonymize_ip': true });
This is belt-and-suspenders — GA4 already anonymises IPs — but documents that you actively configured anonymisation, which may be relevant for the client's compliance records.