Set Up
Before You Begin
Make sure you have the following before starting:- Owner or IAM Admin access in your GCP project: You’ll need to create a service account, assign roles, and generate a key. The Owner, IAM Admin, or an equivalent role is required.
- The dataset(s) you want to sync identified: Know which project, and optionally which datasets and tables, Conversion should be able to read from.
- Your GCP project ID: Found in the Google Cloud Console next to the project name (e.g.
my-company-prod). You’ll need it when connecting in Step 2.
Step 1: Set Up BigQuery Access
Conversion connects to BigQuery using a service account with a JSON key. In this step you’ll create a dedicated service account, grant it read access to your data, and (if needed) configure network access.Create a Service Account
We recommend creating a dedicated service account for Conversion so its activity is easy to monitor and audit in isolation.- In the Google Cloud Console, go to IAM & Admin → Service Accounts and create a new service account (e.g.
conversion-sync). - Grant it the BigQuery Job User and BigQuery User roles (project level).
- Open the service account, go to the Keys tab, and create a new JSON key. Save the downloaded file; you’ll upload it to Conversion in Step 2.
Grant Read Access to Your Data
The service account also needs BigQuery Data Viewer to read your tables. We recommend granting it at the dataset level so Conversion’s access is scoped to exactly the data you want it to see. New tables added to those datasets are picked up automatically. For each dataset you want Conversion to read, open BigQuery, find the dataset in the Explorer panel, click the three dots → Share, and add your service account email (e.g.conversion-sync@my-project.iam.gserviceaccount.com) with the BigQuery Data Viewer role.
Granting Data Viewer at the project level
If your project doesn’t contain data Conversion shouldn’t see, you can grant BigQuery Data Viewer at the project level instead, either during service account creation or later in IAM & Admin → IAM. New datasets are then picked up automatically as you add them.Allow IP Addresses
If your BigQuery project uses VPC Service Controls or restricts access by IP, allow connections from Conversion’s IP addresses:Most BigQuery projects don’t restrict by IP. If you don’t use VPC Service Controls or perimeter rules, you can skip this step.
Step 2: Connect BigQuery to Conversion
- In Conversion, go to Settings → CRM and syncing → Connections.
- Click Add BigQuery connection.
- Fill in the connection details using the values from the earlier steps:
- Click Create connection.
Create a Sync
After connecting, open your new BigQuery connection and go to the Syncs tab to create a sync. Read more about Setting Up a Sync.Writing Queries for BigQuery
A few things to keep in mind before writing your first query:- Name your columns to match Conversion fields. Conversion maps results to fields by column name, so each column in your
SELECTclause must match the field key in Conversion exactly (e.g.email,first_name,userId,event_id). UseASto alias when the source name doesn’t match. - Always filter by
last_sync_timeso each run only processes changed rows. In BigQuery, wrap it withTIMESTAMP_SECONDS(); see Using last_sync_time for details. - Select only the columns you’ll actually use, as every column scanned costs money in BigQuery.
- Schedule large syncs carefully. See Set the Schedule for how often to run queries that return millions of rows.
Contact Sync
ProvideuserId (preferred), email, or both; at least one is required so Conversion can match the contact.
Custom Objects (Without Relationships)
Alias your record’s unique identifier asobject_id, and select the object’s own fields:
Custom Objects with Relationships
To link each record to a related record, alias a column to the key of a relationship field on the object. See Custom Objects with Relationships for the values each related object accepts.object_ididentifies the Product record, andname,sku,category, andpriceare stored on itowneris a relationship field on the Product object that points at Contacts, so each product links to the contact with that email address
Events
Events require a contact identifier (userId or email), event_name, and timestamp. event_id is optional but recommended. Conversion uses it to deduplicate events across runs, so it must be unique across all your event syncs; prefix it with the table name as shown.
BigQuery SQL Reference
Converting Timestamps
Conversion expects Unix timestamps for date/time fields. UseUNIX_SECONDS() to convert BigQuery TIMESTAMP or DATETIME values:
Using last_sync_time
See Incremental Syncing for howlast_sync_time works. In BigQuery, convert it with TIMESTAMP_SECONDS() to compare against a TIMESTAMP column:
Handling NULLs
UseCOALESCE or IFNULL to provide default values:
Casting Types
UseCAST to convert between types:
Querying Across Datasets
Use fully-qualified table names to join across datasets:Troubleshooting
”Permission denied” errors
Ensure your service account has the required roles:- BigQuery Job User (project level)
- BigQuery User (project level)
- BigQuery Data Viewer (on each dataset you want to query)
“Could not connect” errors
Verify that:- You uploaded the service account’s JSON key file, unedited
- Your project ID matches the project the service account belongs to
- Conversion’s IP addresses are allowed if you use VPC Service Controls
Sync taking too long
- Use partitioned tables and filter on the partition column for time-based data
Duplicate data appearing
If you’re using time-buffered queries (subtracting fromlast_sync_time to catch edge cases), Conversion handles duplicates automatically based on the unique key (userId or email for contacts, object_id for custom objects, event_id for events).
Frequently Asked Questions
What BigQuery permissions does Conversion need?
What BigQuery permissions does Conversion need?
The service account needs BigQuery Job User and BigQuery User at the project level, plus BigQuery Data Viewer on the datasets you want to sync. Conversion only reads data; it never writes to your BigQuery project.
How much does this cost in BigQuery?
How much does this cost in BigQuery?
BigQuery charges for the amount of data scanned by your queries. To minimize costs: select only the columns you need, filter with
last_sync_time, and use partitioned tables where possible.How do I sync from multiple datasets?
How do I sync from multiple datasets?
Use fully-qualified table names in your query:Make sure BigQuery Data Viewer is granted on each dataset you reference.