Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4016a79

Browse files
committed
Add Public Beta Docs DOC-609 [netlify-build]
1 parent 0e3f4e5 commit 4016a79

File tree

4 files changed

+539
-0
lines changed

4 files changed

+539
-0
lines changed

src/_data/sidenav/main.yml

+19
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,25 @@ sections:
281281
title: Settings
282282
- path: /profiles/identity-resolution/ecommerce-example
283283
title: E-Commerce Example
284+
- section_title: Profiles Sync
285+
slug: profiles/profiles-sync
286+
section:
287+
- path: /profiles/profiles-sync
288+
title: Setup
289+
- path: /profiles/profiles-sync/sample-queries
290+
title: Sample Queries
291+
- path: /profiles/profiles-sync/tables
292+
title: Tables & Materialized Views
293+
- path: /profiles/profile-api
294+
title: Profile API
295+
- path: /profiles/profile-api-limits
296+
title: Profile API Limits
297+
- path: /profiles/debugger
298+
title: Profile Debugger
299+
- path: /profiles/profiles-gdpr
300+
title: Profiles and GDPR
301+
- path: /profiles/faqs
302+
title: Profiles FAQs
284303
- path: /profiles/profile-api
285304
title: Profile API
286305
- path: /profiles/profile-api-limits

src/profiles/profiles-sync/index.md

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: Profiles Sync Setup
3+
beta: true
4+
---
5+
6+
> info "Profiles Sync Beta"
7+
> Profiles Sync is in beta and Segment is actively working on this feature. Segment's [First-Access and Beta terms](https://segment.com/legal/first-access-beta-preview/) govern this feature. To learn more, reach out to your CSM, AE, or SE.
8+
9+
Profiles Sync connects identity-resolved customer profiles to a data warehouse of your choice.
10+
11+
With a continual flow of synced Profiles, teams can enrich and use these data sets as the basis for new audiences and models. Profiles Sync addresses a number of use cases, with applications for machine learning, identity graph monitoring, and attribution analysis. View [Profiles Sync Sample Queries](/docs/profiles/profiles-sync/sample-queries) for an in-depth guide to Profiles Sync applications.
12+
13+
On this page, you’ll learn how to set up Profiles Sync, enable historical backfill, and adjust settings for warehouses that you’ve connected to Profiles Sync.
14+
15+
## Initial Profiles Sync setup
16+
17+
> info "Identity Resolution Setup"
18+
> To use Profiles Sync, you must first set up [Identity Resolution](docs/profiles/identity-resolution/).
19+
20+
To set up Profiles Sync, you’ll first create a warehouse, then connect the warehouse within the Segment app.
21+
22+
Before you begin, prepare for setup with these tips:
23+
24+
- To connect your warehouse to Segment, you must have read and write permissions with the warehouse Destination you choose.
25+
- During Step 2, you’ll copy credentials between Segment and your warehouse Destination. To streamline setup, open your Segment workspace in one browser tab and open another with your warehouse account.
26+
- Make sure to copy any IP addresses Segment asks you to allowlist in your warehouse Destination.
27+
28+
### Step 1: Create a warehouse
29+
30+
You’ll first choose the Destination warehouse to which Segment will sync Profiles. Profiles Sync supports the Snowflake, Redshift, BigQuery, Azure, and Postgres warehouse Destinations. Your initial setup will depend on the warehouse you choose.
31+
32+
The following table shows the supported Profiles Sync warehouse Destinations and the corresponding required steps for each. Select a warehouse, view its Segment documentation, then carry out the warehouse’s required steps before moving to Step 2 of Profiles Sync setup:
33+
34+
| Warehouse Destination | Required steps |
35+
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
36+
| [Snowflake](/docs/connections/storage/catalog/snowflake/#getting-started) | 1. Create virtual warehouse. <br> 2. Create a database. <br> 3. Create role for Segment. <br> 4. Create user for Segment. <br> 5. Test the user and credentials. |
37+
| [Redshift](/docs/connections/storage/catalog/redshift/#getting-started) | 1. Choose an instance. <br> 2. Provision a new Redshift cluster. |
38+
| [BigQuery](/docs/connections/storage/catalog/bigquery/) | 1. Create a project and enable BigQuery. <br> 2. Create a service account for Segment. |
39+
| [Azure](/docs/connections/storage/catalog/azuresqldw/) | 1. Sign up for an Azure subsription. <br> 2. Provision a dedicated SQL pool. |
40+
| [Postgres](/docs/connections/storage/catalog/postgres/) | 1. Follow the steps in the [Postgres getting started](/docs/connections/storage/catalog/postgres/) section. |
41+
42+
Once you’ve finished the required steps for your chosen warehouse, you’re ready to connect your warehouse to Segment. Because you’ll next enter credentials from the warehouse you just created, **leave the warehouse tab open to streamline setup.**
43+
44+
### Step 2: Connect the warehouse and enable Profiles Sync
45+
46+
With your warehouse configured, you can now connect it to Segment.
47+
48+
During this step, you’ll copy credentials from the warehouse you just set up and enter them into the Segment app. The specific credentials you’ll enter depend on the warehouse you chose during Step 1.
49+
50+
Segment may also display IP addresses you’ll need to allowlist in your warehouse. Make sure to copy the IP addresses and enter them into your warehouse account.
51+
52+
Follow these steps to connect your warehouse:
53+
54+
1. In your Segment workspace, navigate to **Profiles > Profiles Sync**.
55+
2. Select **Add warehouse**, choose the warehouse you just set up, then select **Next**.
56+
3. Segment shows an IP address to allowlist. Copy it to your warehouse Destination.
57+
4. Segment prompts you to enter specific warehouse credentials. Enter them, then select **Test Connection**.
58+
5. If the connection test succeeds, Segment enables the **Next** button. Select it.
59+
* If the connection test fails, verify that you’ve correctly entered the warehouse credentials, then try again.
60+
6. Select **Next** on the **Sync schedule** page. Segment displays the Profiles Sync overview page.
61+
62+
At this point, Segment enables live syncs for your account.
63+
64+
#### Using historical backfill
65+
66+
Profiles Sync sends Profiles to your warehouse on an hourly basis, beginning after you complete setup. You can use backfill, however, to sync historical Profiles to your warehouse, as well.
67+
68+
By default, Segment includes identity graph updates, external ID mapping tables, and two months of the events table in the initial warehouse sync made during setup. Reach out to Segment support if your use case exceeds the scope of the initial setup backfill.
69+
70+
## Working with synced warehouses
71+
72+
<!-- add transition line here -->
73+
74+
### Monitor Profiles Sync
75+
76+
You can view warehouse sync information in the overview section of the Profiles Sync page. Segment displays the dates and times of the last and next syncs, as well as your sync frequency.
77+
78+
In the Syncs table, you’ll find reports on individual syncs. Segment lists your most recent syncs first. The following table shows the information Segment tracks for each sync:
79+
80+
| DATA TYPE | DEFINITION |
81+
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82+
| Sync status | - `Success`, which indicates that all rows synced correctly; <br> - `Partial success`, indicating that some rows synced correctly <br> - `Failed`, indicating that no rows synced correctly |
83+
| Duration | Length of sync time, in minutes |
84+
| Start time | The date and time when the sync began |
85+
| Synced rows | The number of rows synced to the warehouse |
86+
87+
Selecting a row from the Syncs table opens a pane that contains granular sync information. In this view, you’ll see the sync’s status, duration, and start time. Segment also displays a nuanced breakdown of the total rows synced, sorting them into identity graph tables, event type tables, and event tables.
88+
89+
If the sync failed, Segment shows any available error messages in the sync report.
90+
91+
### Settings and maintenance
92+
93+
The **Settings** tab of the Profiles Sync page contains tools that can help you monitor and maintain your synced warehouse.
94+
95+
#### Disable or delete a warehouse
96+
97+
In the **Basic settings** tab, you can disable warehouse syncs or delete your connected warehouse altogether.
98+
99+
To disable syncs, toggle **Sync status** to off. Segment retains your warehouse credentials but stops further Profiles syncs. Toggle Sync status back on at any point to continue syncs.
100+
101+
To delete your warehouse, toggle **Sync status** to off, then select **Delete warehouse**. Segment doesn’t retain credentials for deleted warehouses; to reconnect a deleted warehouse, you must set it up as a new warehouse.
102+
103+
#### Connection settings
104+
105+
In the **Connection settings** tab, you can verify your synced warehouse’s credentials and view IP addresses you’ll need to allowlist so that Segment can successfully sync Profiles.
106+
107+
If you have write access, you can verify that your warehouse is successfully connected to Segment by entering your password and then selecting **Test Connection**.
108+
109+
> info "Changing your synced warehouse"
110+
> If you’d like to change the warehouse connected to Profiles Sync, reach out to Segment support.
111+
112+
<!-- Verify that this doesn't need to be changed -->
113+
114+
#### Sync schedule
115+
116+
Segment supports hourly syncs.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
---
2+
title: Profiles Sync Sample Queries
3+
beta: true
4+
---
5+
6+
Through Profiles Sync, Segment provides data sets and models that can help you enrich customer profiles using any warehouse data available to you.
7+
8+
On this page, you’ll find queries that you can run with Profiles Sync to address common use cases.
9+
10+
> info ""
11+
> The examples in this guide are based on a Snowflake installation. If you’re using another warehouse, you may need to adjust the syntax.
12+
13+
## About example schemas
14+
15+
The queries on this page use two example schemas:
16+
17+
- `ps_segment`, a schema where Segment lands data
18+
- `ps_ materialize`, a schema with your produced materializations
19+
20+
These schema names may not match your own.
21+
22+
## Monitor and diagnose identity graphs
23+
24+
These queries let you view and manage identity graphs, which give you insight into unified customer profiles generated by [identity resolution](/docs/profiles/identity-resolution/).
25+
26+
### Show how many profiles Segment creates and merges per hour
27+
28+
This example queries the `id_graph_udpates` table to measure the rate at which Segment creates and merges profiles, as well as the type of event that triggered the profile change:
29+
30+
```sql
31+
SELECT
32+
DATE_TRUNC('hour',timestamp) as hr,
33+
CASE
34+
WHEN canonical_segment_id=segment_id
35+
THEN 'profile creation' ELSE 'profile merge'
36+
END as profile_event,
37+
triggering_event_type,
38+
COUNT(DISTINCT triggering_event_id) as event_count
39+
FROM ps_segment.id_graph_updates
40+
GROUP BY 1,2,3
41+
```
42+
43+
### Isolate profiles that have reached an identifier's maximum configured value
44+
45+
Segment’s [configurable identifier limits](/docs/profiles/identity-resolution/identity-resolution-settings/) let you set maximum values for identifiers like email. These maximum configured values help prevent two separate users from being merged into a single Profile.
46+
47+
The following query lets you view Profiles that have reached a configured limit for the email identifier:
48+
49+
```sql
50+
WITH agg AS (
51+
SELECT
52+
canonical_segment_id,
53+
COUNT(LOWER(TRIM(external_id_value))) as value_count,
54+
LISTAGG(external_id_value,', ') as external_id_values
55+
FROM ps_materialize.external_id_mapping
56+
WHERE external_id_type='email'
57+
GROUP BY 1
58+
)
59+
SELECT
60+
canonical_segment_id,
61+
external_id_values,
62+
value_count
63+
FROM agg
64+
WHERE value_count > 5 -- set to your configured limit
65+
```
66+
## Reconstruct a profile's traits
67+
68+
<!-- add intro phrase here and fix this next header for clarity -->
69+
70+
### Identify the source that generated the value for a particular trait for a canonical profile as well as its child profiles
71+
72+
When a merge occurs, Segment selects and associates a single trait value with a profile. This logic depends on how you materialize the `profile_traits` table.
73+
74+
You can break out a profile, though, to see the trait versions that existed before the merge. As a result, you can identify a particular trait’s origin.
75+
76+
The following example inspects a particular profile, `use_XX`, and trait, `trait_1`. The query reports the profile’s last observed trait, its source ID, and any profiles Segment has since merged into the profile:
77+
78+
```sql
79+
SELECT * FROM (
80+
SELECT
81+
ids.canonical_segment_id,
82+
ident.segment_id,
83+
ident.event_source_id,
84+
ident.trait_1,
85+
row_number() OVER(PARTITION BY ident.segment_id ORDER BY ident.timestamp DESC) as rn
86+
FROM ps_segment.identifies as ident
87+
INNER JOIN ps_materialize.id_graph as ids
88+
ON ids.segment_id = ident.segment_id
89+
AND ids.canonical_segment_id = 'use_XXX'
90+
AND ident.trait_1 IS NOT NULL
91+
) WHERE rn=1
92+
```
93+
94+
## Measure and model your customer base
95+
96+
<!-- add intro phrase here and fix this next header for clarity -->
97+
98+
### Pull a complete list of your customers, along with their merges, external identifiers, or traits
99+
100+
The following three snippets will provide a full list of your customers, along with:
101+
102+
- The profile IDs merged into that customer:
103+
104+
```sql
105+
SELECT
106+
canonical_segment_id,
107+
LISTAGG(segment_id, ', ') as associated_segment_ids
108+
FROM ps_materialize.id_graph
109+
GROUP BY 1
110+
```
111+
112+
- The external IDs associated with that customer:
113+
114+
```sql
115+
SELECT
116+
canonical_segment_id,
117+
LISTAGG(external_id_value || '(' || external_id_type || ')', ', ') as associated_segment_ids
118+
FROM ps_materialize.external_id_mapping
119+
GROUP BY 1
120+
```
121+
122+
- The customer’s traits:
123+
124+
```sql
125+
SELECT * FROM ps_materialize.profile_traits WHERE merged_to IS NULL
126+
```
127+
128+
### Show all pages visited by a user
129+
130+
To get complete user histories, join event tables to the identity graph and aggregate or filter with `id_graph.canonical_segment_id`:
131+
132+
```sql
133+
SELECT
134+
id_graph.canonical_segment_id,
135+
pages.*
136+
FROM ps_segment.pages
137+
LEFT JOIN ps_materialize.id_graph
138+
ON id_graph.segment_id = pages.segment_id
139+
WHERE canonical_segment_id = ‘use_XX..’
140+
```
141+
142+
### Show the complete history of a trait or audience membership associated with a customer
143+
144+
Suppose you want to track a user’s entrances and exits of the audience `aud_1`. Running the following query would return all qualifying entrance and exits:
145+
146+
```sql
147+
SELECT
148+
id_graph.canonical_segment_id,
149+
identifies.aud_1,
150+
identifies.timestamp
151+
FROM ps_segment.identifies
152+
INNER JOIN ps_materialize.id_graph
153+
ON id_graph.segment_id = identifies.segment_id
154+
AND identifies.aud_1 IS NOT NULL
155+
```
156+
157+
This query works with any Trait or Audience membership, whether computed in Engage or instrumented upstream.
158+
159+
## Frequently asked questions
160+
161+
#### Can I view Engage Audience membership and Computed Trait values in my Warehouse?
162+
163+
Yes. Engage sends updates to Audience membership (as a boolean) and computed trait value updates as traits on an Identify call that Segment forwards to your data warehouse.
164+
165+
The column name corresponds to the Audience or Trait key shown on the settings page:
166+
167+
Surface these values the same way as any other trait value:
168+
169+
- The Trait’s complete history will be in `identifies`
170+
- The Trait’s current state for each customer will be in `profile_traits`
171+
172+
#### What is the relationship between `segment_id` and `canonical_segment_id`? Are they unique?
173+
174+
Identity merges change Segment’s understanding of who performed historical events.
175+
176+
For example, if `profile_b` completed a “Product Purchased” event but Segment understands that `profile_b` should be merged into `profile_a`, Segment deduces that `profile_a` performed that initial “Product Purchased” event.
177+
178+
With that in mind, here's how to differentiate between `segment_id` and `canonical_segment_id`:
179+
180+
- `segment_id` is a unique identifier representing Segment’s understanding of who performed an action at the time the action happened.
181+
- `canonical_segment_id` is a unique identifier representing Segment’s current understanding of who performed that action.
182+
183+
The mapping between these two identifiers materializes in your `id_graph` table. If a profile has not been merged away, then `segment_id` is equivalent to `canonical_segment_id`. If a profile has been merged away, `id_graph` reflects that state.
184+
185+
As a result, you can retrieve a customer’s complete event history by joining an event table, like `product_purchased` to `id_graph`.
186+
187+
For more information, view the [Profiles Sync tables guide](/docs/profiles/profiles-sync/tables/).
188+
189+
#### Should I expect discrepancies between Profile data seen in Segment Profiles (or) UI vs. what’s exposed via Profiles in the Warehouse?
190+
191+
<!-- fix this header^^ -->
192+
193+
Profiles Sync mimics the materialization performed by Segment Profiles. A user’s merges, external IDs, and traits should be expected whether they’re queried in the warehouse, Profile API, or viewed in the UI.
194+
195+
The following edge cases might drive slight (<0.01%) variation:
196+
197+
- Data processed by Profiles hasn’t yet landed in Profiles Sync.
198+
- If you rebuild or use non-incremental materialization for `profile_traits`, Profiles Sync will fully calculate traits against a user. As a result, Profiles Sync would ensure that all traits reflect the most recently observed value for fully-merged users.
199+
200+
By contrast, Segment Profiles and incrementally-built Profiles Sync materializations won’t combine already-computed traits across two merged profiles at the moment of merge. Instead, one profile’s traits will be chosen across the board.

0 commit comments

Comments
 (0)