2025-05-05 | Article | Insights
With the depreciation of tracking cookies, first-party data is becoming increasingly scarce. Having high-quality data is key for the success of all marketers. Currently, one of the most discussed topics is enabling data sharing and forming first-party data partnerships between companies. In this landscape, we find that brands are eager to collaborate with retail companies to launch retail media offerings, pharmaceutical companies and healthcare researchers are partnering with hospitals and doctors to have access to clinical data, and banks and financial institutions are also working together to be able to improve fraud detection.
While enriching existing data is essential, current privacy regulations make reconciling multiple data sources challenging. BigQuery Clean Rooms is providing a solution that balances privacy and utility. It provides a secure, regulated environment where multiple parties can share, join and analyze data, without needing to copy, export or duplicate it.
BigQuery Data Clean Rooms operate on a publish and subscribe model. Partner A publishes a data resource in a clean room, which can be either a BigQuery table or a view. Additionally, Partner A has the capability to configure “analysis rules” to specify detailed access restrictions to the data..
Partner B subscribes to the data resource shared by Partner A and uses it while adhering to the configured “analysis rules''. Partner B can combine this data with their own data resources in order to implement various use cases.
To understand how to set up a data clean room within BigQuery, let's try to implement a hands-on example.
Let's consider a scenario where partner A is a retail company that aims to share the purchase history data with company B which is a marketing company that wants to leverage first party data to enhance its activation strategy.
The table Partner A wants to share data that looks like the following:
SELECT * FROM `dc-int-dwh-dev.retail_data.purchase_history`
1. Enable the Analytics Hub API and grant the needed access.
Once the Analytics Hub API is enabled, we can assign the Analytics Admin Role to the owner of Partner A who will be responsible for creating the clean room, manage data contributors and share the data resources.
2. Create the shared data resource and enforce analysis rules
Once the first step is completed, it is quite straightforward to create a clean room within BigQuery analytics hub, in our case we will name the clean room : “Article Demo” In order to define data sharing rules, partner A can define analysis rules on a view. Anyone trying to run a query against the shared view will have to respect the analysis rule for the query to be able to yield results. Those rules can be directly defined while creating the shared resource on the clean room. We can distinguish between three types of analysis rules: Aggregation, Differential Privacy and List Overlap. You can find more details about these rules in this link.
In this example the Partner A wants to set an aggregation threshold of 2 across the dimension “cusomer_id”. That means that any aggregation query will only output the groups exceeding 2 distinct customer_id values. If a potential row doesn't satisfy this threshold, that row is omitted from the query results.
It is good to know that these rules can also be set using the following query:
CREATE OR REPLACE VIEW `retail_data.purchase_history_view`
OPTIONS (
privacy_policy = '{"aggregation_threshold_policy": {"threshold" : 2,"privacy_unit_column": "customer_id" }}'
)
AS (SELECT * FROM `retail_data.purchase_history`)
Partner A can also configure egress controls such as disabling copy and export of the shared resource data:
3. Share subscriber access to Partner B
Once the data clean room and the shared data resource is created, the clean room owner can grant subscriber access and share the link to it to make it easily accessible to Partner B
1. Adding the clean room as a linked dataset in BigQuery
Partner B can now add the clean room resources as a dataset in its own project by adding the clean room listing. The dataset will automatically have the same name as the clean room’s one and will be highlighted as a linked resource in BigQuery as shown below:
2. Use the shared data resource
Partner B can now start using and querying the shared view using the SELECT WITH AGGREGATION_THRESHOLD statement as shown in the following example:
We can see in the query results that the “Home Appliances”, ”Home Decor” and “Furniture” purchase categories are omitted in the query results since the number of distinct customer id doesn't exceed 2 units.
We have seen in this article that BigQuery Clean Rooms provide a secure environment for data sharing between partners. They enable partners to publish and subscribe to data resources while enforcing configurable analysis rules to maintain privacy and security. This solution addresses the challenges posed by the scarcity of first-party data and evolving privacy regulations, facilitating effective data partnerships and collaborative insights.