Skip to content

Commit 6f877fb

Browse files
authored
Merge pull request #5604 from segmentio/Panandhan22-patch-5
Use account-level SQL traits to associate users to the account
2 parents 53c0a73 + a336b3a commit 6f877fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/engage/audiences/account-audiences.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ Use-cases for account-level computed traits include:
6666
> info ""
6767
> Use SQL traits for complex calculations not supported by computed traits. For example, you would use SQL traits to calculate the number of unique users associated with an account who have logged in during the past month.
6868
69+
### Use account-level SQL traits to associate users to an account
70+
71+
To associate users to an account with SQL traits, you must return both the `group_id` and `user_id` in the account level SQL trait. This fires a Group call which Segment uses to add users to groups in destinations.
72+
73+
When a group (account) contains more than one user, the query returns duplicate `group_id`s (mapped to unique `user_id`s). However, Segment doesn't return duplicate `group_id`s in the account-level SQL trait. As a result, you can't map users to accounts in a many-to-many situation.
74+
6975
### Use account-level computed and SQL traits as account-level audience conditions
7076

7177
Once created, you can connect account-level computed and SQL traits to downstream destinations. You can also use them as conditions in account-level audiences, enabling you to build audiences based on the set of events triggered by all users associated with a given account.

0 commit comments

Comments
 (0)