Google Analytics (GA4) Destination

Introduction

This document provides a comprehensive guide to setting up and using the Ours Google Analytics (GA4) integration, ensuring HIPAA compliance and maintaining data privacy.

Google Analytics Features

The Ours Google Analytics (GA4) integration allows you to automatically track measurement GA4 events (like page views and form submissions) and custom Ours events without writing custom code.

We track and measure these events as closely as possible to native GA4. Ours also uses a collection of static IP addresses that geolocate to the same state, county, or region as your user. These IP addresses allow us to send geographic information without compromising privacy or forwarding email addresses.

Privacy-First Approach

Ours ensures all data sent to Google Analytics remains compliant with privacy regulations, including HIPAA. Key privacy features include:

  • IP Redaction: Ours redacts the user's IP address and replaces it with an IP address from the same geographical region, ensuring location accuracy without exposing personal information.
  • Server Proxying: All events are proxied through Ours servers, preventing Google Analytics from installing cookies on your clients' browsers or seeing their IP addresses.

Tracking Events

Enhanced Measurement Events

The Ours GA4 integration automatically tracks enhanced measurement events such as page_view and scroll without needing to add these to the allow list, as they are collected by default. For more details, you can refer to the Google Analytics Enhanced Measurement documentation.

Custom and Recommended Events

If you want to track custom events or recommended GA4 events, you need to whitelist these events in your Ours dashboard:

  1. Allow the Event: Add the event name to your Event Allowlist in the Ours dashboard.
  2. Track the Event: Use the ours('track', 'EventName') function to send the event.
  3. Optionally Rename Event: Use the Ours renaming function to rename and obfuscate your events in GA4.

Note: Google Analytics limits the length of event names to 40 characters. If you send an event name longer than 40 characters, it will be truncated to 40 characters in Google Analytics.

Tracking GA4 Recommended Events

GA4 has special recommended events that get reported differently. These include event names like add_payment_info, purchase, tutorial_complete, etc.

To send these, you:

  1. Allow the recommended event name for your GA4 destination.
  2. Send the recommended event through Ours with any event properties the event requires.

See GA4's recommended allowed events here.

Example

Using GTM

Using Javascript SDK

ours("track", "add_payment_info", {
  currency: "USD",
  value: 10.5,
  coupon: "test 123",
});

Configuring Google Analytics

To add a destination, click on Destinations from your Ours platform. Click the Add destination button and select Google Analytics as the destination type to add.

Find your Measurement ID

  1. Go to Settings > Data streams > Open the data stream you use.
  2. Copy the Measurement ID. It should look like: G-B37DJMM3H3.

Automatic Page View and Interaction Tracking

To automatically track page_view and other standard interactions in GA4, go to Destinations > Google Analytics > Settings and toggle the switch on. Also, ensure you enable form_submission and link click tracking in GA4 (it's enabled by default).

Tracking automatic events

When you have this switch toggled on, Ours will automatically track:

  • Page Views: No need to manually set up or send PageView events. Ours handles this automatically.
  • Interactions Expected by GA4: Events like scroll tracking are automatically collected and sent to Google Analytics.

Debugging Google Analytics

  1. Remove existing GA4 tracking
  • Since Ours is tracking page views and all other events, you should remove GA4 tracking to avoid counting double for all events. If you can't remove all other GA4 accounts, make sure you at least remove tracking to the account you have tracked through Ours. Ours GA4 integration will work with other accounts tracked on the same page, but will not work if you try to track to the same account with Ours and with native GA4 on the same page.
  1. Remove all Universal Analytics (UA) Scripts
  • Universal Analytics pre-dated GA4. It was deprecated in 07/2023. Please make sure to remove it before installing Ours.

Get Started Today

Implement Ours effortlessly with our simple copy-and-paste installation script. Begin optimizing your analytics without compromising privacy. For more information on setting up custom events, visit the Tracking Your First Event guide.