Skip to content

Commit 46780e8

Browse files
authored
Merge pull request #3978 from segmentio/jacobwsmith19-patch-1
Add example to only send events with userId
2 parents 7492a15 + f132bbe commit 46780e8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/connections/destinations/destination-filters.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The following examples illustrate common destinations filters use cases:
6868
* [Remove internal and test events from production tools](#remove-internal-and-test-events-from-production-tools)
6969
* [Sample a percentage of events](#sample-a-percentage-of-events)
7070
* [Drop events](#drop-events)
71+
* [Only send events with userId](#only-send-events-with-userid)
7172

7273
### PII management
7374

@@ -108,6 +109,26 @@ Using the [destination filters API](https://docs.segmentapis.com/tag/Destination
108109

109110
[Watch this destination filters walkthrough](https://www.youtube.com/watch?v=47dhAF1Hoco){:target="_blank"} to learn how to use event names to filter events sent to destinations.
110111

112+
### Only send events with userId
113+
114+
Use the [Public API](https://docs.segmentapis.com/tag/Destination-Filters/){:target="_blank"} to only send events to your destination if they contain a `userId`. Here's an example of how you might format this request:
115+
116+
```json
117+
{
118+
"sourceId": "<SOURCE_ID>",
119+
"destinationId": "<DESTIANTION_ID>",
120+
"title": "Don't send event if userId is null",
121+
"description": "Drop event if there is no userId on the request",
122+
"if": "length( userId ) < 1 or typeof( userId ) != 'string'",
123+
"actions": [
124+
{
125+
"type": "DROP"
126+
}
127+
],
128+
"enabled": true
129+
}
130+
```
131+
111132
## Important notes
112133

113134
#### Conflicting settings

0 commit comments

Comments
 (0)