Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Connect Google Cloud Service account

Use Firestore, BigQuery and other Google Cloud services from your GTM server container by connecting a Service Account from your own Google Cloud project.

When do you need this?

Some server-side tags and variables read from or write to Google Cloud. Common examples:

  • Firestore Lookup variable — enrich events with data stored in Firestore, for example to build an extra conversion action based on customer or order data.

  • Firestore Writer tags — store event data in Firestore.

  • BigQuery tags — stream tracking data into your own BigQuery dataset.

These tags authenticate with the Google credentials of the server container. Because your data lives in your own Google Cloud project, you create a Service Account in that project and connect it to your AdPage container. AdPage does not hand out a shared Service Account that you grant access to: you stay owner of the account, the permissions and the key.

In the AdPage dashboard this setting is called Google BigQuery, but the Service Account you upload there is used for all Google Cloud access from your server container, Firestore included.

Step 1: create the Service Account

1

Open IAM in your Google Cloud project

In the Google Cloud Console, select the project that contains your Firestore database (or BigQuery dataset) and go to IAM & Admin → Service Accounts.

2

Create the account

Click Create service account and give it a recognisable name, for example adpage-sgtm.

3

Grant the roles

Give the account only the roles your tags need:

Use case
Role

Firestore Lookup (read only)

Cloud Datastore Viewer (roles/datastore.viewer)

Firestore Writer (read and write)

Cloud Datastore User (roles/datastore.user)

BigQuery

BigQuery Data Editor (roles/bigquery.dataEditor) and BigQuery Job User (roles/bigquery.jobUser)

Need both Firestore and BigQuery? Give the same Service Account all the roles you need. A container holds one Service Account at a time (see Things to know).

4

Create a JSON key

Open the Service Account, go to Keys → Add key → Create new key, choose JSON and download the file.

Step 2: connect the Service Account in AdPage

1

Open the container settings

In the AdPage dashboard, go to Containers, open your container and click Settings.

2

Upload the JSON file

In the menu on the left, choose Google BigQuery. Drag the JSON file into the upload area (or click to select it) and click Save.

BigQuery export screen with the Service Account upload area
BigQuery export: upload the JSON key of your Service Account.
3

Check the status

When the upload succeeds, the section shows that a Service Account is connected.

Step 3: use it in your GTM server container

For a Firestore Lookup variable:

  1. In your GTM server container, go to Variables → New and choose Firestore Lookup.

  2. Enter the collection path and the document path or query.

  3. Under Advanced, enable Override Project ID and enter the ID of the Google Cloud project that contains your Firestore database. Without this, the variable looks in the project the server container runs in, not in yours.

The same applies to Firestore and BigQuery tags from the Community Template Gallery: always enter your own project ID.

Things to know

  • One Service Account per container. Uploading a new JSON file replaces the previous one. If you use the container for both BigQuery and Firestore, use one Service Account with all the roles it needs.

  • Rotating the key. Create a new key in Google Cloud, upload it in AdPage, check your tags in Preview Mode and only then delete the old key in Google Cloud.

  • Revoking access. Deleting the key or the Service Account in Google Cloud stops access immediately. Tags that depend on it will then fail.

Was this helpful?