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.
Step 1: create the Service Account
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.
Grant the roles
Give the account only the roles your tags need:
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).
Step 2: connect the Service Account in AdPage
Open the container settings
In the AdPage dashboard, go to Containers, open your container and click Settings.
Step 3: use it in your GTM server container
For a Firestore Lookup variable:
In your GTM server container, go to Variables → New and choose Firestore Lookup.
Enter the collection path and the document path or query.
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?


