A Server-Side Google Tag Manager (sGTM) variable template that allows you to fetch, track, and extract data directly from your Supabase database using the Supabase REST API.
- Direct Database Queries: Query any Supabase table directly from your sGTM container.
- Query Filtering: Apply conditions and filters using standard Supabase PostgREST syntax (e.g.,
eq,gt,is). - Dot Notation Extraction: Easily extract specific nested data or array elements from the JSON response without writing custom code.
- Smart Caching: Built-in caching to avoid unnecessary API calls.
- Go to you your Google Tag Manager Server-Side container and click on Templates in the left sidebar. Go to the Variables section and click on the "Search Gallery" button to create a new variable. Search for Supabase Lookup and click on it to add it to your container.
- Go to Variables, create a new User-Defined Variable, and select the Supabase Lookup template.
- Configure the following fields:
- Project URL: Your Supabase project URL (e.g.,
https://xyz.supabase.co). - API Key: Your Supabase
anonorservice_rolekey (depending on your required access level). - Table Name: The exact name of the table you want to query.
- Project URL: Your Supabase project URL (e.g.,
- (Optional) Add Query Conditions: Add key-value pairs to filter the database request.
- Example: Key:
email| Value:eq.user@example.com
- Example: Key:
- (Optional) Set Document Path: Use dot notation to return a specific value from the API response instead of the entire JSON array.
- Example:
0.emailwill extract the email address of the first record returned.
- Example:
- (Optional) Enable Cache: Check "Store the result in cache" and set an expiration time in minutes to prevent redundant API calls for repeated lookups.
- Save the variable. You can now use it in your Tags, Triggers, or other Variables.
The Supabase Lookup Variable for Google Tag Manager Server-Side is developed and maintained by Stape Team under the Apache 2.0 license.
🟢 Listed