The Google Sheets Tag for Google Tag Manager Server-Side allows you to send data directly from your server container to a specified Google Sheet. This enables you to log events, capture form submissions, or store any other data for analysis and reporting.
The tag supports two primary actions:
- Add row: Appends a new row with your specified data to the end of the selected range.
- Update cells: Overwrites the data in a specific cell or range of cells.
- Add the Google Sheets Tag to your server container in GTM.
- Select the Action Type (
Add row
orUpdate cells
). - Provide the Spreadsheet URL of the Google Sheet you want to write to.
- (Optional) Specify the Sheet Name (e.g.,
Sheet1
). If omitted, the first visible sheet will be used. - Specify the Rows Range using A1 notation (e.g.,
A1:Z1
). - In the Data section, map the values you want to send to the sheet. Each entry corresponds to a cell in the specified range.
- Choose your Authentication method.
- Stape Google Connection – Uses a simplified setup via Stape's connection.
- Own Google Credentials – Uses Application Default Credentials from your GCP environment.
- Add a trigger to fire the tag.
- Type: The action to perform.
- Add row: Appends data. The
Rows Range
parameter will be used to determine the last row of the table to append the new data. - Update cells: Replaces data in the specified
Rows Range
.
- Add row: Appends data. The
- Spreadsheet URL: The full URL of the target Google Spreadsheet.
- Sheet Name: The name of the specific sheet (tab) within the spreadsheet you want to write to. This is optional if the sheet name is included in the
Rows Range
. - Rows Range: The A1 notation of the range to interact with. For example,
A1:D1
for the first four columns of the first row. IfSheet Name
is not provided, you can specify it here (e.g.,'My Sheet'!A1:D1
).
- Auth Type:
- Stape Google Connection: A simplified authentication method for Stape users. Requires enabling the Google Sheets Connection in your container settings. Learn more.
- Own Google Credentials: Uses Application Default Credentials from a Google Cloud Platform environment. This requires enabling the Google Sheets API on GCP, setting up a service account and granting it access to your Google Sheet. Learn more.
- Data List: A table where you define the values to be sent. Each "Cell Value" you add will be placed in the next available cell of the
Rows Range
you defined (from left to right).
- How to write data from server Google Tag Manager to Google Sheets
- How to set up the Stape Google Connection
- How to set up the Own Google Credentials
The Google Sheets Tag for GTM Server-Side is developed and maintained by the Stape Team under the Apache 2.0 license.