# Integration Setup

## Prerequisite: Setting up the GA4 -> BigQuery export

Before setting up this integration, you should already have linked your GA4 property to a BigQuery project in Google Cloud Platform, and the linkage should already be populating data in the BigQuery project.

If you don't have your GA4 property linked to a BigQuery project, [here are some instructions on how to do so](https://www.ga4bigquery.com/tutorial-how-to-set-up-bigquery-linking-in-your-google-analytics-4-property-ga4/).

If you have never used Google Cloud Platform or BigQuery, the following video will help you navigate successfully **setting up the GA4 -> BigQuery linkage**:

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWDvO31PP3F01d6jisBTt%2Fuploads%2FohYUGM7ZZ4jJLUr4Kepo%2FGA4%20BigQuery%20walkthrough.mp4?alt=media&token=fc24b2de-84f1-4afd-980d-a9d958cec708>" fullWidth="true" %}

### Google Cloud Platform costs

By setting up the GA4 -> Bigquery linkage and the **Google Analytics via BigQuery** integration, you will incur costs on Google Cloud Platform.

Google Cloud Platform charges you in two ways:

1. **Storage costs** - You will be charged monthly based on the amount of data you have stored in Google Cloud Platform. Unless you have millions of visitors a day, this will likely only be a few dollars per month.
2. **Analysis costs** - You will also be charged monthly based on the amount of analyses you run on your data stored in Google Cloud Platform. If you stick to only the standard queries that we plan to run on your data and do not have millions of visitors per day, again this should only be a few dollars per month.

In the days after setting up the GA4 -> Bigquery linkage and the **Google Analytics via BigQuery** Daasity integration, you should monitor your Google Cloud Platform costs to get a sense of how much this process will cost you. You can view this information via [the Billing page in Google Cloud Platform](https://console.cloud.google.com/billing).

## Setting up the Google Analytics 4 via BigQuery Daasity integration

Once you have established the GA4 -> BigQuery linkage and data is populating, you can set up the **Google Analytics 4 via BigQuery** integration in Daasity.

<details>

<summary>Step 1: Create a new Google Analytics 4 via BigQuery integration</summary>

In the Daasity App, navigate to **Integrations** > **New Integration** and select **Google Analytics 4 via Big Query**

![](/files/HksFaMBBLVu8qlnDaSzR)

</details>

<details>

<summary>Step 2: Add BigQuery Configuration details</summary>

The new integration will have a **BigQuery Configuration** section like the one below:

<img src="/files/umGTVGYtjJQ4S6AIOhh5" alt="" data-size="original">

To get these details, navigate to <https://console.cloud.google.com/bigquery> and make sure you are in the project that contains your exported GA4 data.

The **GCP Project** and **Dataset** can be found in the lefthand menu. The dataset you choose should have the same 9-digit number as your GA4 property:&#x20;

![](/files/PunBlwfdbqckkxerftNA)

<mark style="background-color:orange;">NOTE: If you do not see an analytics\_ dataset, it may be because (A) you are in the wrong project, in which case you should navigate to the project that you used to set up the GA4 -> BigQuery export, or (B) your GA4 -> BigQuery export has not begun sending data, in which case you should check back again in 24 hours.</mark>

The **Stream ID** setting in the **BigQuery Configuration** is optional. Only add this if you want data from a single stream ID to flow into this integration. You can [learn more about stream IDs here](https://support.google.com/analytics/answer/12332343?hl=en).

</details>

<details>

<summary>Step 3: Create a service account for Daasity</summary>

In order for Daasity to be able to extract your GA4 BigQuery data, we need you to create a service account that we can use to give us read access.

To start creating a service account, navigate to <https://console.cloud.google.com/iam-admin/serviceaccounts/create>

In the details section, use whatever name, ID, and description details you prefer:

![](/files/emrgV2dTTef9L1RSbZAz)

Then, click **CREATE AND CONTINUE**.

***

Grant the service account **BigQuery User** and **BigQuery Data Viewer** roles in the project.&#x20;

The easiest way to do this is search for those specific roles in the dropdowns:

![](/files/QI0xKG1fnu2yuWuza5Ej)

Then, click **CONTINUE**.

***

Granting users access to the service account is entirely optional:

![](/files/lYpuvblNlXzCPyu1Ca57)

Finally, click **DONE**

</details>

<details>

<summary>Step 4: Generate a service account key for the Daasity service account</summary>

The service account key will act as a password that will allow the Daasity service account access to your BigQuery data.

To generate it, first navigate to <https://console.cloud.google.com/iam-admin/serviceaccounts>

Then, click on the email of the service account you created in the previous step:

![](/files/nNWgnNjOH4qPL3LIqrj7)

***

On the next page, navigate to the **KEYS** tab:

![](/files/Q4mwIztdLFMUivDRXYjt)

***

Click **ADD KEY** and choose **Create new key**:

![](/files/itTo6KwtvUNBpRgxYbjA)

***

In the pop-up, choose **JSON** and click **CREATE**:

![](/files/qBEwdGIRK5uPW60PmWcg)

This should generate a .json file that will be downloaded to your computer. You will use this file in the next step.

</details>

<details>

<summary>Step 5: Add the service account key to the integration in Daasity</summary>

Go back to the integration setup screen in Daasity.

In this step, you're going to add the service key information you generated in the previous step in the **BigQuery Account** of the integration settings:

![](/files/xMTuFX6MvgkskXxPUofF)

You have 2 choices of how to do this:

A. Drag the file you downloaded in Step 4 onto the screen where it says **Drag file here**, or

B. Open the file you downloaded in Step 4, copy the contents, click the **Enter Key** tab, and paste the contents

<mark style="background-color:yellow;">Once this is done, move to Step 6.</mark>

</details>

<details>

<summary>Step 6: Link to other integrations</summary>

The **Link to Commerce Integration** section allows you to tell us which old Universal Analytics integration the GA4 BigQuery integration corresponds to and which ecommerce integration the data is related to:

![](/files/5IBa955Y0LbpopDqWwA9)

If this GA4 BigQuery integration will be taking over for a Universal Analytics integration after the July 1 UA sunset, choose it from the **Linked Universal Analytics integrations** menu.

If you want GA4 BigQuery data to take precedence over Universal Analytics data *before* 7/1/2023, specify the date in the **GA4 Cutover Date** section.&#x20;

If the GA4 BigQuery data is specific to an existing ecommerce integration in Daasity, choose it from the **Linked eCommerce Store** menu.

Click the **CREATE** button in the upper right corner of the screen.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.daasity.com/core-concepts/data-integrations/setup-guides/digital-integrations/google-analytics-4/bigquery-integration/integration-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
