How to connect Google Service Account to stape

Apr 9, 2022
Also available in

With the help of a Google Service Account connected to stape, you integrate server Google Tag Manager with BigQuery and Firestore. This blog post will show how to create a Google Service Account and connect it to your stape container.

What is Google Service Account, and what possibilities does it bring to sGTM?Copy link to this section

Google Service Accounts can be used by applications to make authorized API calls. With the help of a Google Service Account connected to the sGTM container, it is possible to integrate BigQuery and Firestore with server GTM. 

To create a Google Service account, you will need to have a Google Cloud Platform account and generate an Access Key. The service account JSON key file must be added to an sGTM container power-up in to authenticate with these services.

Firestore is a database that can write/read or sync data. It can be used to enrich data sent using server-side tags. For example, with the help of user ID, you can extract additional user data from Firestore and send more user parameters to Facebook CAPI, which will increase the FB event match quality score.

To simplify integration, Google released the Firestore Lookup variable. With the help of this variable, you can extract specific values from the Firestore document. The only disadvantage is that Firestore is not a free service - check the price here.

Using server Google Tag Manager, it’s possible to write data directly to BigQuery from sGTM Tag or Client. Previously BigQuery integration was only available for 360 users. With the release of sGTM and GA4, all users can send data to BigQuery for free or cheaper than before. BigQuery is also not free - check its pricing here.

How to connect Google Service Account to stape?Copy link to this section

1. Create or login to the Google Cloud Platform web console.

2. Select IAM & Admin -> Service Accounts -> Click Create service account.

create google service account

3. Add account -> Click Next -> Select Roles BigQuery Data Editor role for BigQuery access or the Cloud Datastore User role for Firestore. 

If you want to use Google Service Account only for BigQuery, choose only the BigQuery Data Editor role. The same for Firestore. 

When you get to the 3rd step, just click Done. 

select role google service account

4. Create private key -> Select JSON -> select Create -> JSON will be downloaded to your computer. 

create private key

5. Open your account -> open sGTM container -> open Power-ups tab -> Click on Google Service account -> Upload JSON file that you’ve downloaded from Google Cloud -> Click Save. 

Need help with setting up server-side tagging?

All it takes is a few simple questions. Click Get A Quote, fill-up the form, and we will send you a quote.

Get a Quote
Tagged with:gtm server

Host your GTM server at Stape