# Sharing GA4 Data through BigQuery

## **What are the necessities?**

1. GA4 measurement set up
2. Google Cloud Project\* in Big Query with billing details\*\*

*\* Don't have a Google cloud account yet?*[ *Create your account now*](https://cloud.google.com/bigquery/?hl=cs)*.*\
*\*\* Set up the billing details* [*here*](https://console.cloud.google.com/freetrial/signup/tos?pli=1)*. The billing details are necessary to have the most recent data in the export, otherwise you will have 2 days lag of the exported data. You will not be charged anything unless you switch to a paid plan. If you have a lot of data (10+ mil. sessions monthly), the pricing can be found here. The Big Query is rather cheap and you get plenty of storage and queries monthly for free (more than enough to cover Roivenue integration).*

## **Permissions required?**

The set up will have to be done by a person with certain rights. These are:

1. At least Editor permissions in the GA4 property
2. Google Cloud Project owner
3. Read access to Google Ads

## **Content of This Tutorial**

1. [Connection of GA4 and Big Query](#1.-create-a-gcp-project)
   1. How to create a project.
   2. How to link GA4 with Big Query.
2. [Connection of Google Ads and Big Query](#1.-create-a-link-between-google-a-ds-and-big-query)
   1. How to link Google Ads and Big Query
3. [Invitation of Roivenue user into your account with certain permissions GA4 <-> Big Query connection](#sharing-access-to-bq-with-roivenue)

## GA4 <-> Big Query Connection

**If you already have streaming export running, skip this part.**

### 1. Create a GCP project

If you do not have any project created in Big Query yet, [create your first one](https://console.cloud.google.com/projectcreate).&#x20;

The page will look like this:

<figure><img src="/files/G4hZ2cWZjlNqiYO2x3rW" alt=""><figcaption></figcaption></figure>

Fill in the project name, select your organisation and location. The name can be anything - for example - Ga4BigQueryExport. For the remaining 2 fields you should have just 1 option in each. Then create the project.

### 2. Create a link between GA4 property and Big Query

**Permissions required:**

1. Editor rights in GA4 property or higher
2. Big Query project owner *(if you completed Step 1 you already have this permission)*

Head to Google Analytics 4 property which you want to connect to Roivenue, and go to settings (gear button in the left bottom corner).\
Under **Property settings -> Product links** select BigQuery links.

Create a new link by clicking the "Link" button. Screen like this will pop up:

<figure><img src="/files/S8Ts9qMhZ5YMvZT9EG2Y" alt=""><figcaption></figcaption></figure>

A. Select the project from Step 1.

B. Data location - select **European Union (EU)**

C. Type of export - select **streaming**.

*(If you select daily export, you will not have data for the previous day!)*

D. Events to exclude - **none**.

This will create an export of data from GA4 to Big Query.

## Google Ads <-> Big Query export

**If you do not use auto-tagging (not likely), skip this part.**

*(At the moment, there is one unresolved issue on Google's side, and that is the Google Ads data issue. This issue concerns only accounts with auto-tagging turned on.)*

### 1. Create a link between Google Ads and Big Query

**Permissions required:**

1. Big Query Admin role on project level
2. Google Ads read permissions

Firstly you will have to activate Google Big Query API - you can do so [here](https://console.cloud.google.com/apis/library/bigquery.googleapis.com).

\
Link of Google Ads to big query is done in Big Query -> data transfers -> new transfer ->

Google Ads.

<figure><img src="/files/aIJ7UFaQc5lmb82mOGT7" alt=""><figcaption></figcaption></figure>

You will be asked to fill in these details:

1. Display name - name of the import, it can be anything.
2. Schedule - **Repeat frequency = Days, At = 00:30**
3. Start now
4. Dataset - create a new dataset where we will feed the Google Ads data.

{% hint style="warning" %}
Make sure to select the same location as for your Google Analytics dataset!
{% endhint %}

<figure><img src="/files/fi7ki2LI1Bg7TtZojXKf" alt=""><figcaption></figcaption></figure>

&#x20; 5\. Customer ID - add ID from Google Ads (eg. 5xx-0x5-5xxx)\
&#x20; *(can be found in your Google Ads account in the top right corner)*\
&#x20;    *a. If you have multiple accounts, connect your MCC (to save some time)*

6. Refresh window - blank
7. Table filter: ClickStats,Campaign,AdGroup\
   ![](/files/HS1mVIYZCGrsjQMLS7fZ)
8. Leave the rest in default state

   —------------------

   **At this moment, the set-up should be successfully finished. We can connect your data to Roivenue.** \
   —---------------------

## Sharing access to BQ with Roivenue

To do so, we will need you to invite user - <connections@roivenue.com> to both (GA4 and Google Ads) of your new datasets as **Google Big Query Viewer** and as a **Google Big Query Job User** to your project.

### Viewer permissions

1. In the explorer you can see multiple rows: roivenue-com is a project, analytics\_xxxxx are datasets. Click on the 3 dots of the new dataset that you have created by linking GA4 with Big Query and click “share”.\
   ![](/files/Q3Y8S3C3qm1cZTTXoL8O)
2. New tab will open. Click “add principal”.
3. Fill in the details (as in the picture) and save:\
   ![](/files/hS9LvUegjJ3Bxw3FTHJT)

4\. Repeat the process for all Google Analytics properties.

### Job User

Open a Big Query Menu (Left top corner 3 lines next to “Google Cloud”. Head to IAM & Admin > IAM. Click "Grant Access".\
Same window as for the Data Viewer will open. Use the same email, select **BigQuery Job User** as role.

**At this moment, your BigQuery is connected to the Roivenue. Inform your Client Success Manager that the accesses were given.**


---

# 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://docs.roivenue.com/roivenue-resources/howto/sharing-ga4-data-through-bigquery.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.
