Recipes
Any Industry

Clean room collaboration with AWS Clean Rooms and Segment

User privacy laws and strict data privacy standards have made it challenging for advertisers and brands to collect and share consumer data in a privacy compliant manner. Data clean rooms are controlled and secure environments where customer data is processed or analyzed in a way that ensures privacy and compliance with data protection regulations. Data clean rooms offer privacy-centric computing, querying, and aggregated reporting to help unlock powerful use cases such as audience overlap analysis, attribution modeling, and campaign measurement. For businesses that choose to set up their own clean rooms, attaining and leveraging clean, complete, and compliant customer data is a challenge. Brands often lack the ability to easily build a complete view of their customers to then onboard into clean room solutions. Using Segment’s Golden Profiles alongside AWS Clean Rooms is a powerful combination to facilitate robust advertising and analytics use cases. This recipe will show you exactly how to use these tools and empower marketers and analytics teams to thrive in a privacy centric world.

Safdar Jaffari

Made by Safdar Jaffari

Igor Krtolica

Made by Igor Krtolica

What do you need?

  • AWS Clean Room access

  • Segment Workspace

Easily personalize customer experiences with first-party data

With a huge integration catalog and plenty of no-code features, Segment provides easy-to-maintain capability to your teams with minimal engineering effort. Great data doesn't have to be hard work!

Get started for free

Step 1: Create profiles In Unify

Segment collects customer interaction data from various sources like your websites, mobile apps, backend servers, and cloud applications. Segment will utilize first-party identifiers set by you, gathered from various sources to create customer profiles. In addition to known users, Segment will create anonymous profiles containing all interactions and traits for any unknown users. You have the freedom to select the first-party identifiers that suit your business needs. 

To initiate your identity resolution and begin creating these profiles, simply navigate to the "Unify Settings" located on the left-hand sidebar within your Segment account and follow the simple steps within our documentation

sj1
sj2

Step 2: Setup Profile Sync

Now that you have your Profiles, it’s time to set up Profile Sync to land the identity resolved profiles in Redshift. Follow the simple steps within our documentation to set this up.  Note that this requires a configured data warehouse.  In this example we will be using Amazon Redshift as the data warehouse.  If you do not have a Redshift cluster set up, you can provision one quickly using the Redshift Quick Start Cloud Formation template linked here.  If you are setting up Redshift for the first time, note that Segment currently requires you to enable a public IP address for the Redshift cluster; this will require you to whitelist Segment IPs listed in the documentation above.

sj3

After configuring the profile sync, you will need to materialize views using DBT.  You can use the Cloud DBT example linked above, or follow the instructions below to run DBT from the console using the DBT-Redshift package.  Later, we will show how to use these tables to export profile data into a Clean Room. Below is an example of what golden profile records can look like in Redshift with all customer traits, audience membership, and advance calculation available as data points for each customer.

sj4
sj5

Step 3: Deploy AWS Clean Room ingestion stack

Amazon Clean Rooms requires a dataset in the Glue Data Catalog, hosted on S3.  For this example, we are going to configure a Glue Crawler in an ETL Job to move data from the materialized views in Redshift to S3, then we will configure a Clean Room using this data set.

sj6

The ETL Job can run a query against the Redshift tables from Unify and return information about your users that you can expose in a Clean Room.  Example queries are shown in the Segment docs.  We are going to use the following query here:

SELECT * FROM profiles_media.profile_traits WHERE merged_to IS NULL

This will return all of the user traits available and the associated user ids that can be used to link user behaviors or values like LTV to a particular user.

sj7

Once you have finished configuring your ETL job, and it has run successfully, check that there is a table in the data catalog you specified.  This job can be set to run on a schedule to match the Segment Unify Profile export schedule.

Step 4: AWS Clean Room set up

You can now set up a Clean Room.  

  1. Open the AWS Clean Rooms console, and click the ‘Configured tables’ link in the navigation pane, then click the ‘Configure new table’ button.

  2. Select the Glue database you created for your ETL Job.

  3. Select the output table from the ETL Job; you can turn on the ‘View schema from AWS Glue’ option to view the columns that are available in the table you created.

    sj8

  4. In this case we are going to select ‘All Columns’ to be available in the table that we publish.

  5. Name the table, in this case we are using `segment-unify-user-traits`.

  6. Click the `Configure new table` button.

sj9

Before you can use the table for querying in a Clean Room, you will need to configure an analysis rule.

sj10

Click the ‘Configure analysis rule’ button to start the process.

sj11

Analysis rules are described in more detail here.  For this example, we are going to allow List queries against this table.  Click the Next button.

sj12

You will need to select the columns that users of the table are allowed to use in joins.  This allows you to control which identifiers can be used as a key to external tables.  Clicking Next will give you the opportunity to review the rule that was just created.  Click Configure analysis rule to confirm the rule creation.

Step 5:  Create a Collaboration to allow external accounts to query your table

A Collaboration will allow owners of other AWS accounts to query the tables that you just created.  This step will enable the Collaboration.  You will be able to specify parameters that allow you to to control what aspects of the data you provide in your tables are available to external accounts.

sj13
sj14

If you want the accounts you specified above to immediately be invited to the collaboration, select the settings below on the next screen:

sj15

After creating the collaboration, you will need to associate the table you created earlier with the collaboration.  This will allow members of the collaboration to start querying your table.

sj16

Step 6: Overlap analysis, attribution, and measurement in AWS Clean Room

Now that your clean room is set up, you can begin to use it for overlap analysis, attribution, and measurement. Overlap analysis allows you to understand the intersection of different user groups, while attribution helps you identify which marketing activities are driving conversions. Measurement, on the other hand, enables you to assess the effectiveness of your campaigns.

Here is additional detail on these capabilities:

  • Overlap Analysis: Use this feature to understand the shared audiences between different marketing campaigns, products, business units, and brands. This can help you to optimize your marketing strategy, discover intersections between different customer groups, and avoid message fatigue among your audience.

  • Measurement: You can measure a variety of metrics, including but not limited to, reach, impressions, click-through rates, conversion rates, and revenue generated.

  • Attribution: By tying conversions and other important events back to the marketing activities that led to them, you can understand which activities are most effective. This will enable you to allocate your marketing budget more efficiently.

Remember to always respect user privacy and comply with all relevant data protection regulations when conducting these analyses.

For more information on best practices for security in AWS Clean Rooms, read the best practices guide in the docs.  

Wrapping up

By following this recipe, you have now created a clean room in AWS using AWS Clean Rooms and Segment collected 1P data. This clean room will provide a privacy-safe environment for your data analysis, and the insights generated can help to increase your revenue and ROAS.

Recipe Summary

  • How to build a Golden Profile in Segment Unify

  • How to send the Golden Profile to Redshift

  • How to leverage the Golden Profile to build a clean room with AWS Clean Rooms 

  • How to facilitate audience overlap analysis, attribution and measurement use cases 

Getting started is easy

Start connecting your data with Segment.