By using the Google Analytics 4 Streaming connection, you can export data directly to BigQuery without any event collection limits. This is unlike the native GA4 BigQuery export, where the built-in limits could potentially result in loss of optimisation signals.
Getting started
Google Analytics 4 should be already implemented on your website via Google Tag Manager (setup instructions).
-
Inside the admin panel navigate to Settings > Google Analytics.
-
Choose Google Analytics 4 Streaming from the list.
-
Configure the Referral exclusion list to match your Google Analytics property.
-
Edit the Timezone setting if necessary.
-
Click on the Endpoint field to copy its value to your clipboard and click SAVE.
- Follow the integration guide depending on how you have implemented Google Analytics 4, either through GTM or Google Tag.
Integrating using Google Tag Manager (GTM)
-
Go to the Tags section in the Google Tag Manager container.
-
Open your Google Analytics: GA4 Configuration tag and copy it.
-
Rename the copied tag to GA4 Streaming Configuration.
-
Edit the value in the Measurement ID field so that it doesn’t match the original configuration. For example, you can delete the last character of the ID to change
G-PRMV4V4Z0Z
toG-PRMV4V4Z0
. -
Edit the configuration and select the Send to server container option.
-
Paste the Endpoint value of the Google Analytics 4 Streaming data source (from step 5 of this guide) into the Server Container URL field, and click Save.
-
Copy all the Google Analytics: GA4 Event tags.
-
Rename the copied event tags using the format GA4 Streaming - {event name}.
-
Set the Configuration Tag option of all copied event tags to GA4 Streaming Configuration.
-
Click Save and Publish the container.
-
Data will appear in the events_ga4 table of the BigQuery dataset used in the SegmentStream project BigQuery configuration. The data schema of the events_ga4 table matches the native GA4 BigQuery Export schema.
Integrating using Google Tag (gtag.js)
- In your website code, locate the implementation of the Google Analytics 4 tag.
- After finding the line with your current tag, add a new tag that uses a different TARGET-ID than the original configuration. For example, you can remove the last character of the ID to change G-PRMV4V4Z0Z to G-PRMV4V4Z0.
- The new tag should have a transport_url parameter contains the value of the Endpoint field you copied from the admin panel.
- See an example of the code below:
gtag('config', 'YOUR-CURRENT-TARGET-ID');
gtag('config', 'NEW-TARGET-ID', {
'transport_url': 'https://track.segmentstream.com/ds/{TARGET-ENDPOINT}',
}); - Deploy the code to your production server.
- Data will appear in the events_ga4 table of the BigQuery dataset used in the SegmentStream project BigQuery configuration. The data schema of the events_ga4 table matches the native GA4 BigQuery Export schema.
Comments
0 comments
Please sign in to leave a comment.