Skip to content

Commit 6d25e79

Browse files
author
markzegarelli
committed
fix conflicts
2 parents 020fc61 + 9b51218 commit 6d25e79

File tree

4 files changed

+111
-8
lines changed

4 files changed

+111
-8
lines changed

src/_data/sidenav/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ sections:
324324
title: Subscription States
325325
- path: /engage/user-subscriptions/engage-source
326326
title: Engage Events Source
327+
- path: /engage/user-subscriptions/subscription-sql
328+
title: Subscriptions with SQL Traits
327329
- section_title: Profiles
328330
description: "See how to create audiences based on data."
329331
section:

src/engage/profiles/csv-upload.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ You can also [set subscription states](#set-user-subscriptions) for each email a
1010

1111
## Upload a CSV file
1212

13-
There are two ways you can navigate to the Upload CSV page:
14-
- Select **Engage > Audiences > Profile explorer** and click **Upload CSV**.
15-
- Select **Profiles > Profile explorer** and click **Upload CSV**.
13+
Use the **Upload CSV** page to upload a CSV file in your Segment space:
14+
1. Navigate to **Profiles > Profile explorer** or **Engage > Audiences > Profile explorer**.
15+
2. Click **Manage subscription statuses**, then select **Update subscription statuses**.
16+
3. Select **Upload a CSV**, then click **Configure**.
1617

1718
### 1. Download your CSV template
1819

@@ -49,24 +50,28 @@ Every time you upload a file, you have the option to add a custom trait to user
4950

5051
Custom traits display in the Custom Traits tab of a user profile in the Profile explorer.
5152

52-
## View upload history
53+
## View Update History
5354

54-
Use the Upload history page to view CSV file uploads in your workspace over the last 30 days.
55+
Use the Update History page to view CSV file uploads in your workspace over the last 30 days.
5556

56-
Navigate to **Engage > Audiences > Profile explorer** or **Profiles > Profile explorer** and select the **CSV upload history** tab.
57+
To view the Update History page:
58+
59+
1. Navigate to **Profiles > Profile explorer** or **Engage > Audiences > Profile explorer**.
60+
2. Click **Manage subscription statuses**.
61+
3. Select **View update history**.
5762

5863
Select links to view CSV files and any associated [error reports](#error-reports). View the status of the file upload and the custom trait name added to user profiles in the CSV upload.
5964

6065
### Error reports
6166

6267
Use error reports to fix invalid rows and quickly re-upload data.
6368

64-
From the Upload history page:
69+
From the Update History page:
6570

6671
1. Select the link in the **Report** column to download an error report CSV. All rows not present in the error report were processed successfully.
6772
2. Correct data in the invalid rows.
6873
3. Remove any extra columns such as `row_number`, `error_message`, and `error_code`.
69-
3. Click **Upload CSV** and re-upload the file.
74+
3. Click **Update subscription statuses**, and select **Upload a CSV** to re-upload the file.
7075

7176
## Set user subscriptions
7277

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
title: Subscriptions with SQL Traits
3+
plan: engage-premier
4+
beta: true
5+
---
6+
7+
Use Subscriptions with SQL Traits to connect to your data warehouse and query user subscription data to Engage on a scheduled basis. Use your data warehouse as a single source of truth for subscription statuses and query from warehouses such as BigQuery, Redshift, or Snowflake.
8+
9+
On this page, you'll learn how to use SQL to sync subscription data from your warehouse to Engage.
10+
11+
## Getting started
12+
13+
To use Subscriptions with SQL Traits, you need the following:
14+
- A warehouse connected to Segment
15+
- A Segment workspace
16+
- A user account with access to Engage in that workspace
17+
18+
> info ""
19+
> Segment supports Redshift, Postgres, Snowflake, Azure SQL, and BigQuery as data warehouse sources for SQL Traits. Visit [Segment's warehouse docs](/docs/connections/storage/warehouses/) for more on getting started with data warehouses.
20+
21+
> success ""
22+
> Before you begin with Subscriptions with SQL Traits, you may also want to visit the [subscription docs](/docs/engage/user-subscriptions/) to learn more about user subscriptions in Engage.
23+
24+
## Sync subscription data with SQL
25+
26+
You can sync with SQL from two locations in the Segment app. Navigate to **Profiles > Profile explorer** or **Engage > Audiences > Profile explorer**, then:
27+
28+
1. Click **Manage subscription statuses**, and select **Update subscription statuses**.
29+
2. Select **Sync with SQL**, and click **Configure**.
30+
31+
### Configure your SQL query
32+
33+
To configure Subscriptions with SQL Traits, you can write your own query or click **Use Template** to use one of the templates Engage provides. For any new users that your query returns, Engage adds a new profile.
34+
35+
> success ""
36+
> Click **Reset Template** to reset your SQL query.
37+
38+
Queries must return at least one pair of the columns below with a value of `subscribed`, `unsubscribed`, or `did_not_subscribe`:
39+
- `email` and `_segment_internal_email_subscription_`
40+
- `phone` and `_segment_internal_sms_subscription_`
41+
42+
For more subscription SQL best practices, view the [query requirements](#query-requirements) below.
43+
44+
### Select a warehouse and preview your query
45+
46+
Once you write your SQL query, click **Select warehouse** from the Configure screen to select the data warehouse you'd like to query.
47+
48+
Before you schedule your sync intervals, click **Preview** to preview a subset of data and validate your results. To see subscription statuses for a particular profile, select a user row, then select the Identities tab.
49+
50+
### Schedule sync intervals
51+
52+
You can schedule sync intervals to import subscription data from your warehouse to Engage:
53+
54+
1. From the Configure screen, click **Schedule**.
55+
2. Add a SQL job name and description.
56+
3. Set the sync schedule.
57+
- Choose a time to start the SQL job and how often to run syncs.
58+
4. Click **Create** to create and save the SQL job.
59+
60+
> info ""
61+
> SQL queries are executed directly to your data warehouse, which could generate additional costs for pay-per-query warehouses.
62+
63+
### View SQL job history
64+
65+
Use the Update History page to view all SQL jobs.
66+
67+
1. Navigate to **Profiles > Profile explorer** or **Engage > Audiences > Profile explorer.**
68+
2. Click **Manage subscription statuses**.
69+
3. Select **View update history**, then select the **SQL Jobs** tab.
70+
71+
From the Update History page, you can view details for each SQL job including the creation date and time, compute status, and the number of users updated across all runs for a job. Click the job link to visit a particular SQL job Overview page.
72+
73+
## Query requirements
74+
75+
When you build your SQL query, keep the following requirements in mind for the data your query returns.
76+
77+
**Your query must:**
78+
79+
- Return at least one column with `user_id`, `anonymous_id`, `email`, `phone` (or `group_id` for account traits if Profiles for B2B is enabled).
80+
- Return records less than 16KB in size.
81+
82+
**Your query must not:**
83+
84+
- Include values for both `user_id` and `anonymous_id` for a given record.
85+
- Return any `user_id`s, `anonymous_id`s, or `group_id`s with a `null` value.
86+
- Return any records with duplicate `user_id`s.
87+
- Return duplicate `email` or `phone` records that have different subscription statuses.
88+
- Return more than 25 million rows.

src/engage/user-subscriptions/subscription-states.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ Uploading contacts with a CSV file works best for initial batches of contacts yo
8585

8686
To learn more about both options, reference the Engage documentation on using the [CSV uploader](/docs/engage/profiles/csv-upload/) and setting user subscriptions.
8787

88+
### Sync subscription statuses with SQL
89+
90+
Use SQL to import user subscription states from your data warehouse back to Engage. When you sync with SQL, you can query user subscription data at automated intervals. Pull subscription statuses for each contact vector and use your data warehouse as a single source of truth for subscription data.
91+
92+
This option is especially useful if you don't have the ability to set subscription states with CSVs or Segment's Public API.
93+
94+
View [Subscriptions with SQL Traits](/docs/engage/user-subscriptions/subscription-sql/) for more information.
95+
8896
### Troubleshooting subscription states
8997

9098
On occasion, a user’s subscription state may not be up-to-date. For example, a user may have unsuccessfully attempted to unsubscribe from your marketing campaigns.

0 commit comments

Comments
 (0)