GuidesGA4 Server-Side

GA4 Server-Side

Learn how you can configure GA4 server-side tracking with Hardal to improve data collection accuracy, enhance privacy, and bypass ad blockers

Set up Google Analytics 4 server-side tracking using Hardal to improve data accuracy, enhance privacy compliance, and bypass ad blockers.

Make sure to check the partner's website and API documentation for the most up-to-date information and configurations.

Set Up Server-Side GTM

Complete the Server-side Google Tag Manager setup first.

Configure GA4 Client

In your server-side GTM container:

  1. Go to "Clients" and click the built-in "GA4" client
  2. Configure settings:
    • Default GA4 paths: Enabled
    • Default gtag.js paths: Enabled with your GA4 Measurement ID
    • Automatically serve dependent scripts: Enabled
    • Cookies and Client Identification: JavaScript Managed
  3. Save configuration

Create GA4 Server Tag

  1. In server container, go to "Tags" → "New"
  2. Select "Google Analytics: GA4" tag type
  3. Enter your GA4 Measurement ID
  4. Create trigger: "Some Events" where "Client Name equals GA4"
  5. Save as "GA4 Server Tag"

Configure Web Container

In your client-side GTM container:

  1. Create new "Google Tag"
  2. Enter your GA4 measurement ID
  3. Add configuration parameter:
    • Name: server_container_url
    • Value: Your Hardal sGTM Tagging URL
  4. Set trigger to "All Pages"
  5. Save and publish

Test Implementation

  1. Enable Preview mode in both containers
  2. Navigate to your website
  3. Verify events reach server container
  4. Confirm GA4 tag fires in server container
  5. Check GA4 Real-Time reports for event delivery