> ## Documentation Index
> Fetch the complete documentation index at: https://docs.segmentstream.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GA4 BigQuery Export

> Set up Google Analytics 4 BigQuery Export to send event data to SegmentStream for attribution and ML-powered insights.

To use event data from Google Analytics 4 in SegmentStream, you need to first set up a Google Analytics 4 BigQuery Link. Refer to the [Set up GA4 BigQuery Link](/project-configuration/events-tracking/ga4-bigquery-export/set-up-ga4-bigquery-link) guide and ensure the following requirements are met:

* The data location of the BigQuery dataset used in SegmentStream matches the one configured in GA4.

  <img src="https://mintcdn.com/segmentstream/8dSgvo9-hrckH6OT/images/ga4-bigquery-data-location.png?fit=max&auto=format&n=8dSgvo9-hrckH6OT&q=85&s=b4a00ec3cf25405716e8242502e57628" alt="GA4 BigQuery data location setting" width="2370" height="1396" data-path="images/ga4-bigquery-data-location.png" />

* Both the **Daily** and **Streaming** export types are enabled.

  <img src="https://mintcdn.com/segmentstream/00kzL-5hE2xz3Tg1/images/ga4-bigquery-streaming-export.png?fit=max&auto=format&n=00kzL-5hE2xz3Tg1&q=85&s=be6e29c93070d2b820fee3b3664ca0ee" alt="GA4 BigQuery streaming export setting" width="2118" height="2044" data-path="images/ga4-bigquery-streaming-export.png" />

* No events are excluded in your BigQuery Link settings.

  <img src="https://mintcdn.com/segmentstream/8dSgvo9-hrckH6OT/images/ga4-bigquery-no-excluded-events.png?fit=max&auto=format&n=8dSgvo9-hrckH6OT&q=85&s=0f73440e10ad7c7ed09e6452fec3be7b" alt="GA4 BigQuery no excluded events" width="2728" height="1694" data-path="images/ga4-bigquery-no-excluded-events.png" />

Once the GA4 BigQuery Export is set up, data should start flowing to your BigQuery project within 24 hours. After that happens, you can connect your Google Analytics 4 to SegmentStream.

## Connecting Google Analytics 4 to SegmentStream

<Steps>
  <Step title="Navigate to events tracking">
    Inside the admin panel navigate to **Settings** > **Events Tracking**.
  </Step>

  <Step title="Add Google Analytics 4">
    Click **+ ADD** and select the **Google Analytics 4** option.
  </Step>

  <Step title="Authorise your Google account">
    In the drawer that opens, authorise your Google account.
  </Step>

  <Step title="Select account and property">
    Select the account and property where your data is collected.
  </Step>

  <Step title="Save">
    Click **Save**.
  </Step>

  <Step title="Wait for data processing">
    All event data exported to your BigQuery in the past 60 days will be processed by SegmentStream, and reports will become available. This process might take a couple of hours.
  </Step>
</Steps>

<Info>
  Follow the guide on [Additional GA4 settings](/project-configuration/events-tracking/ga4-bigquery-export/additional-ga4-settings) to pass additional parameters that help SegmentStream integrate better with your business.
</Info>

<img src="https://mintcdn.com/segmentstream/8dSgvo9-hrckH6OT/images/ga4-connect-segmentstream.png?fit=max&auto=format&n=8dSgvo9-hrckH6OT&q=85&s=d2d36f9570f34746b2098b96883eeebd" alt="GA4 connection in SegmentStream" width="2395" height="1396" data-path="images/ga4-connect-segmentstream.png" />

## Referral exclusion logic

To ensure SegmentStream provides accurate insights, it must correctly identify where each session's traffic is coming from. Properly setting up referral exclusions is key, especially when users move between different domains or subdomains during redirects.

Typical scenarios for using referral exclusions include stopping traffic from payment gateways, login systems, or other internal processes from being counted as external referrals.

SegmentStream uses the settings from your Google Analytics 4 (GA4) property to filter out unwanted referrals. If your GA4 is correctly set up, SegmentStream automatically applies those same settings. This process helps identify and exclude unwanted referral traffic through the following methods:

* Identifying when visitors navigate within different parts of your site or its subdomains, preventing these movements from being counted as external visits.
* Redirects between websites specified in your GA4 stream's cross-domain measurement function are treated similarly to redirects within the same domain and are excluded from referral tracking. Learn more about [setting up cross-domain measurement](https://support.google.com/analytics/answer/10071811?hl=en) in Google's documentation.
* You can further control unwanted referrals by configuring the unwanted referrals list in your GA4 stream settings. Refer to Google's documentation for [configuring unwanted referrals](https://support.google.com/analytics/answer/10327750?hl=en).

## BigQuery access issues

If the Google Analytics 4 BigQuery link is connected to a different project than the one specified in the SegmentStream BigQuery settings, you need to provide additional permissions before connecting event tracking.

### Get your service account email

1. In your SegmentStream project, navigate to **Settings** > **Events Tracking**.
2. Click on the Google Analytics 4 option.
3. Select the account and property where your data is collected.
4. Copy the service account email from the Google Analytics 4 connection settings.

<img src="https://mintcdn.com/segmentstream/ZFr6pt66noWB70nu/images/ga4-service-account-email.png?fit=max&auto=format&n=ZFr6pt66noWB70nu&q=85&s=faeeaef76b99971e8bebf03f6045c5bc" alt="Service account email in SegmentStream" width="2754" height="1504" data-path="images/ga4-service-account-email.png" />

### Find the BigQuery project linked to GA4

1. In your [Google Analytics](https://analytics.google.com/) property, go to **Admin**.
2. Under Product Links, click **BigQuery Links**.
3. You will see the ID and name of the linked project.

<img src="https://mintcdn.com/segmentstream/8dSgvo9-hrckH6OT/images/ga4-bigquery-linked-project.png?fit=max&auto=format&n=8dSgvo9-hrckH6OT&q=85&s=b8d3b78813458ca81a824834a2a41540" alt="GA4 BigQuery linked project" width="2714" height="1592" data-path="images/ga4-bigquery-linked-project.png" />

### Set permissions in your Google Cloud account

<Steps>
  <Step title="Open IAM in Google Cloud Console">
    Go to the [IAM page](https://console.cloud.google.com/iam-admin/iam) in the Google Cloud Console.
  </Step>

  <Step title="Select the linked project">
    Click on the project selection menu in the navigation bar, and select the project linked to Google Analytics 4.

    <img src="https://mintcdn.com/segmentstream/ZFr6pt66noWB70nu/images/gcp-select-project.png?fit=max&auto=format&n=ZFr6pt66noWB70nu&q=85&s=eaf4eaf7cfc7a61e6ead38350758d2e6" alt="Google Cloud project selector" width="2386" height="1520" data-path="images/gcp-select-project.png" />
  </Step>

  <Step title="Grant access">
    Click **GRANT ACCESS**.

    <img src="https://mintcdn.com/segmentstream/ZFr6pt66noWB70nu/images/gcp-grant-access.png?fit=max&auto=format&n=ZFr6pt66noWB70nu&q=85&s=e7033b0a410f3e49d956397dbb2ac8ab" alt="Google Cloud grant access button" width="2390" height="1394" data-path="images/gcp-grant-access.png" />
  </Step>

  <Step title="Configure roles">
    1. Paste the service account email address into the **New principals** field.
    2. Select the [**BigQuery Data Viewer** and **BigQuery User**](https://cloud.google.com/bigquery/docs/access-control#bigquery-roles) roles.
    3. Click **Save**.

           <img src="https://mintcdn.com/segmentstream/ZFr6pt66noWB70nu/images/gcp-bigquery-roles.png?fit=max&auto=format&n=ZFr6pt66noWB70nu&q=85&s=daeb3986687060c39b2c00999aeb79b6" alt="BigQuery roles configuration" width="2368" height="1596" data-path="images/gcp-bigquery-roles.png" />
  </Step>
</Steps>

### Test connection and save

1. Return to your SegmentStream project and navigate to the Google Analytics 4 connection.
2. Click **TEST CONNECTION**.
3. If the permissions have been correctly set up, the **SAVE** button should be active. Click it to complete your Google Analytics 4 tracking setup.

<img src="https://mintcdn.com/segmentstream/ZFr6pt66noWB70nu/images/ga4-test-connection.png?fit=max&auto=format&n=ZFr6pt66noWB70nu&q=85&s=ccc5a5730a4365a88d30c647b44a0462" alt="GA4 test connection in SegmentStream" width="2754" height="1504" data-path="images/ga4-test-connection.png" />

## In this section

<CardGroup cols={2}>
  <Card title="Set up GA4 BigQuery Link" icon="link" href="/project-configuration/events-tracking/ga4-bigquery-export/set-up-ga4-bigquery-link">
    Step-by-step guide to linking your GA4 property to BigQuery.
  </Card>

  <Card title="Additional GA4 settings" icon="gear" href="/project-configuration/events-tracking/ga4-bigquery-export/additional-ga4-settings">
    Configure custom user properties and event parameters for better integration.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.