Skip to content
Menu

Integrations

BigQuery, Firebase and Snowflake

BetaMarkdown version

Sync users and events from BigQuery (including the Firebase Analytics and GA4 export) or Snowflake with your own queries, and write decisions back to a table your BI tools can read.

Note

Built and tested against each vendor's documented API; tell us if anything differs in your account.

Warehouses are pulled, not pushed: there is no webhook URL. You paste a key and SQL queries when you connect. An hourly job runs each active warehouse integration. Sync now runs one immediately. Test signs in, runs SELECT 1 and up to five rows of each query, and writes nothing.

What you'll need

  • An admin of the account. Integrations are set up in Settings → Integrations.
  • BigQuery: a service account with BigQuery Data Viewer and Job User on the project (plus Data Editor on the dataset for write-back), and its JSON key.
  • Snowflake: a user with key-pair auth and a role that can read your tables and use the warehouse.
  • A SQL query for users and one for events that follow the column contract.

Connect

Note

Warehouse tables and queries run in your account. Give the service account or user only the access listed here.

BigQuery. Create a service account with BigQuery Data Viewer and Job User on the project (plus Data Editor on the dataset for write-back). Create a JSON key and paste it. Settings:

SettingMeaning
projectIdDefault: the key's project_id
locationOptional
datasetIdNeeded for the Firebase preset and write-back
usersQuery, eventsQueryYour queries, standard SQL
audiencesQueryOptional: see Audiences
presetfirebase, or none
writeBackOn or off

Snowflake. Create a user with key-pair auth (ALTER USER … SET RSA_PUBLIC_KEY = '…') and a role that can read your tables and use the warehouse. Paste the unencrypted PKCS#8 private key (-----BEGIN PRIVATE KEY-----). Settings: account (for example xy12345.us-east-1), user, role (optional), warehouse, database, schema, usersQuery, eventsQuery, audiencesQuery and writeBack. Column names are matched without regard to case.

Column contract

Columns are matched by name. Other columns are ignored for events and become attributes for users.

QueryColumnMeaning
usersuser_idRequired (text or number). Rows without it are skipped and counted.
usersemailEmail contact. An invalid one is dropped and the user kept.
userssignup_at, last_active_atTimestamps
usersupdated_atOnly moves the cursor
usersany otherAn attribute: strings, numbers and booleans; nulls and other types are left out
eventsuser_id, name, timestampRequired. A row missing one is skipped and counted.
eventsevent_idOptional. Otherwise it is derived from the user, name and time, so re-reading a row is a duplicate.
eventspropertiesA JSON object, or a string holding one

{{since}} and the cursor

In a query, {{since}} becomes a quoted ISO timestamp literal, such as '2026-11-20T09:17:00.000Z', which both warehouses compare to a timestamp column:

sql
SELECT user_id, email, updated_at FROM app.users WHERE updated_at >= {{since}}

Each query keeps its own cursor. The first run reads from 7 days ago.

  • Events: the query is wrapped as SELECT * FROM (<query>) ORDER BY timestamp LIMIT 50000, and the cursor becomes the newest timestamp ingested. Use >= when several events can share a timestamp: ids make the overlap duplicates.
  • Users: the query is wrapped with LIMIT 10000. The cursor becomes the newest updated_at when the rows have one, otherwise the run's start time. Filter users on updated_at so a capped run catches up next hour.
  • The cursor moves only when every query of the run succeeded. A failed run records the error, shown on the integration's card, and the next run retries from the same place.
  • Runs never overlap. A run is skipped while another is less than 55 minutes old, and Sync now answers 409.

Firebase Analytics and GA4 (BigQuery)

Link Firebase or GA4 to BigQuery, set datasetId to the analytics_<id> dataset and turn on the Firebase preset. The events query is then generated, so you do not write one. It reads events_* from the dataset, takes event_name as the event name and turns event_params into the event's properties.

Only events with a user_id (your app's setUserId) are read. Events with only a user_pseudo_id are not. Intraday tables match events_* too, and their rows become duplicates when the daily table lands.

Write-back

With writeBack on, the first sync at or after 02:00 UTC each day writes the previous UTC day's decisions, with their outcomes so far, to a table it creates if missing.

ColumnBigQuerySnowflake
decision_id, user_id, agent_id, agent_name, variant_id, variant_name, channel, conversion_eventSTRINGSTRING
sent_at, converted_atTIMESTAMPTIMESTAMP_NTZ
rewardFLOAT64FLOAT
holdoutBOOL, always false because holdout users get no decisionBOOLEAN

BigQuery writes <dataset>.herald_decisions. Snowflake writes HERALD_DECISIONS in the configured database and schema, merging on decision_id. A failed write-back is shown as the last error and retried next hour. Conversions that land after the export day are not re-sent.

Audiences

Define segments in SQL. The optional audiences query returns two columns, user_id and audience, and each distinct audience becomes an externally managed segment named BigQuery: <audience> (or Snowflake: <audience>) that agents target like any other segment.

sql
SELECT user_id, tier AS audience FROM customers WHERE tier IN ('VIP', 'Churn risk')
  • It runs in full every hour, without {{since}}. Each audience's members are replaced by what the query returned, and an audience that stops appearing is emptied.
  • Members Herald doesn't know yet are created, as cohort members are. Rows missing either column are skipped and counted.
  • Up to 50 audiences and 50,000 rows. Over either limit, the run changes nothing and shows the error, so a segment is never half-replaced.
  • You can't edit these segments in the console. Change the query instead.
  • Test shows up to five audience rows.

Use with Looker Studio, Tableau and Power BI

Point the tool at the write-back table (herald_decisions in BigQuery, HERALD_DECISIONS in Snowflake), or at the Google Sheets tab from Reporting and exports. Looker Studio and Power BI read Google Sheets directly. For a one-off, use the decisions CSV.

Limits

  • 10,000 users and 50,000 events per run per integration. The rest comes next hour.
  • 50 audiences and 50,000 audience rows per run.
  • Queries time out after 120 seconds.

Troubleshooting

  • Rows are skipped. A users row needs user_id. An events row needs user_id, name and timestamp.
  • The same rows arrive every hour. Filter on a timestamp column with {{since}}.
  • The Firebase preset finds nothing. Check datasetId and that your app calls setUserId.

Common errors

VendorMessageCauseFix
BigQueryBigQuery: <message> or BigQuery answered HTTP <status>BigQuery refused the query, often a SQL error or missing permissionRun the query in BigQuery and fix it
BigQueryGoogle sign-in failedThe service account key can't sign inPaste a current JSON key
BigQueryBigQuery query timed outThe query ran too longNarrow it with {{since}}
BigQueryBigQuery refused <n> rowsWrite-back rows were refusedCheck the decisions table's schema
BigQueryprojectId is not a valid project id or datasetId may contain only letters, numbers and underscoresSaving the integration: a bad idCopy the ids from Google Cloud
SnowflakeSnowflake: <message> or Snowflake answered HTTP <status>Snowflake refused the statementRun the query in Snowflake and fix it
SnowflakeSnowflake statement timed outThe query ran too longNarrow it with {{since}}
Snowflakeaccount is not a valid account identifierSaving the integration: a bad accountUse the account identifier, such as xy12345.us-east-1
BothWrite-back failed: <reason>Writing decisions back failedCheck the user's write access
BothAudiences failed: The audiences query returned more than 50,000 rows; nothing was changedThe query returned too many rowsNarrow the query; the segments keep their members until it fits
BothAudiences failed: The audiences query returned more than 50 audiencesToo many distinct audience valuesReturn fewer audiences

See Herald decide live →