Links

Google Analytics 4

This page describes how to use Census with Google Analytics 4

🏃‍♀️ Getting Started

In this guide, we will show you how to connect Google Analytics 4 to Census and create your first sync.
GA4 has some very interesting behaviors with identifiers, custom fields, and delayed data indexing. If something is confusing, take a look at the Understanding GA4 Identifiers and Quirks section below.

Prerequisites

Step 1: Add a Data Stream to your Google Analytics 4 property

In order to add a Google Analytics 4 connection, you'll need to create what Google calls a Data Stream. A Data Stream represents events from either a website or a Firebase app. Google describes the process in more detail in their docs.
For a Web App:
  • First create a new stream or choose an existing one in Admin > Data Streams. If creating a new one, specify Web type.
  • Then within the selected datastream, visit Measurement Protocol > Create
  • Copy the Secret Value and the Measurement ID
For Firebase (iOS/Android) applications:
  • First create a new stream or choose an existing one in Admin > Data Streams. If creating a new one, specify iOS or Android types.
  • Then within the selected datastream, visit Measurement Protocol > Create
  • Copy the Secret Value
  • You'll also separately need the Firebase App ID. The identifier for a Firebase app is found in the Firebase console under: Project Settings > General > Your Apps > App ID

Step 2: Create the Census Connection

  • Navigate to the Census Connections page and click Add Service
  • Select Google Analytics 4 from the drop down list (Not Google Analytics)
  • Configure the three settings:
    • Add the Secret Value in the API Secret box of the connection.
    • Add the Measurement ID or Firebase App ID in App ID
    • Specify the Connection Type: Either GTag for websites or Firebase for iOS/Android apps.

Step 3: Create your first sync

The sync will move event data from your warehouse to your Google Analytics 4 property. Before continuing, you may first want to read our article on Syncing Event Data.
  1. 1.
    From inside your Census account, navigate to the Syncs page and click Add Sync.
  2. 2.
    Under What data do you want to sync?, choose your data warehouse as the Connection and your source: either a Model from the Census Models tab or a database table.
  3. 3.
    Under Where do you want to sync data to?, choose the Google Analytics 4 connection you created in Step 2 as the Connection.
    • Under Object select Event
  4. 4.
    Under How should changes to the source be synced?, Append will be automatically selected for the Events destination object.
  5. 5.
    Under How are source records identified?? Select a unique Event ID from your data source. Census needs a unique identifier for each new event to sync.
  6. 6.
    Under Which properties should be updated? Map the individual source columns to the destination fields. Some of those fields exist by default, but you may also want to add more custom properties. See below for more information on how GA4 handles custom fields.
  7. 7.
    Click the Next button to see the final preview which will have a recap of what will happen when you start the sync. If you're happy, check the Sync Now checkbox and save the sync.
  8. 8.
    Confirm the data arrives in Google Analytics!
If you need any help configuring Google Analytics, contact the Census support team to get some help.

🗄 Supported Objects and Behaviors

Learn about all of our sync behaviors in Core Concepts.
Object Name
Supported?
Identifiers
Behavior
Event
Unique Event ID
Append
User Properties
Client ID or
App Instance ID
Update Only (ID must already exist in GA4)
Both Event and User Properties support sending custom properties that have already been defined in Google Analytics 4 (see below for more details on the restrictions on custom properties). To send custom properties as part of a sync, you can add destination fields via the new Custom Field button as well as the Properties Bundle structured object which can be used to send more complex event data structures.
Contact us if you want Census to support more objects and behaviors for Google Analytics 4.

💡 Understanding GA4 Identifiers and Quirks

GA4 uses a combination of a half dozen different identifiers to associate the data coming from Census with data being collected directly by Google.

The Property and Data Streams

A Property is the "container" like it was in UA, but now in GA4, the property can span across web and mobile apps traffic. It must be set up as a Google Analytics 4 property. If you haven't yet moved, visit Google's docs to learn more about migrating to Google Analytics 4.
A GA4 Property has one or more Data Streams which send data to the property (you'll actually be required to set one up when creating a new property). The typical gtag integration will be set up as a Data Stream. You can think of Census as piggybacking or enriching the user activity already happening in those data streams.
Census connects to your GA4 property through a data stream which is uniquely identified by a combination of two of three identifiers provided when you first set up the connection (see Step 1).
  • An API Secret Value - This is a typical API Key. It should never be published anywhere public or user facing. Census will use it to securely talk directly to GA4's Measurement API.
  • One of: A Measurement ID for web/gtag integrations (not a Stream ID) or a Firebase App ID (not an App Instance ID - See Below)
With these two, Census can begin adding event and user data to the data stream.
Identifying Users
Google Analytics 4 also uses a pair of identifiers to identifier users when syncing user properties and events data.
  • A User Pseudo ID which you can think of as uniquely identifying the user on a single device. It's going to be one of:
    • A Client ID for web/gtag connections. This must be collected from the browser by calling gtag.js('get') .
    • An App Instance ID for iOS/Android connections. This must be collected from within the app context by calling the equivalent of the getAppInstanceId() (the method name varies by language, see Google's documentation).
  • Optionally, an additional User ID. This uniquely identifies the user across devices and can associate their activity across multiple. Note that the property must be configured to use a User ID.

Custom Properties (Dimensions and Metrics)

Google Analytics supports custom properties they call Dimensions and Metrics, both on the event and the user scope. Their docs have a lot of detail on this powerful functionality but there's a few things to keep in mind for Census:
  • Before using Custom Dimensions and Metrics in Census, they must be defined in Google Analytics up 48 hours before they can be used by Census. Yeah, kinda nuts. It looks like the new Custom fields will start showing up in the first few hours but data may not populate until 24-48 hours later.
  • Google limits the number of user and event scoped custom dimensions and metrics. For most GA4 properties, a maximum of 50 custom event dimensions and 25 custom user dimensions are allowed. See Google's docs for the up to date list of limits.
  • Avoid syncing "high cardinality" dimensions. Google defines high cardinality dimension as having more than 500 unique values in a single day. So stick to using dimensions that look like categories or tags.

Other Delays

One last thing to keep in mind. GA4 now supports a real-time view of events and, once the above custom dimension restrictions are passed, you should see your events in real-time (ish, up to a minute delayed in some cases). However, there are still some additional delays in reporting:
  • For many Google Analytics reports, data imported this way will only shows up if the User ID has been used as a visitor to the property in the last 30 days.
  • Data takes up to 24 hours to be fully indexed by google
Contact us if your use cases don't work with these limitations. We'd love to hear how we can make this connection better in the future!