You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transformations allow you to change data as it flows through Segment to either correct bad data or customize data for a specific destination. At this time, you can change event and property names to align events with your Tracking Plan, or to conform to a destination-specific requirement. For example, a Transformation could be created to change an event name from `completed_order` to `Order Completed` to conform to [Segment's ecommerce spec](/docs/connections/spec/ecommerce/v2/#order-completed).
10
+
With Transformations, you can change data as it flows through Segment to either correct bad data or customize data for a specific destination. Change event and property names to align events with your Tracking Plan, or to conform to a destination-specific requirement. For example, you can create a Transformation to change an event name from `completed_order` to `Order Completed` to conform to [Segment's ecommerce spec](/docs/connections/spec/ecommerce/v2/#order-completed).
11
+
12
+
You can also use [Segment's Public API](https://docs.segmentapis.com/tag/Transformations){:target="_blank"} to transform events, properties, and property values for many [use cases](#use-cases).
13
+
11
14
12
15
**Transformations are very powerful and should be applied with care!**
13
16
@@ -21,15 +24,15 @@ Segment's goal is to make Transformations a powerful tool that complements a wel
21
24
### Other important notes
22
25
23
26
-**Transformations cannot be applied retroactively:** They only apply to data moving forward. However, you can manually extract and re-send (or even [Replay](/docs/guides/what-is-replay)) events through a source with an active destination Transformation, which will send the transformed events to your destinations.
24
-
-**Transformations are only available to Protocols customers:** If you are interested in this feature, contact your Account Executive or CSM to learn more about the Protocols package.
27
+
-**Transformations are available to Protocols customers:** If you're interested in this feature, contact your Account Executive or CSM to learn more about the Protocols package.
25
28
-**Source-level transformations are irrevocable:** When applied at the source, a transformation permanently changes the structure of the event. The original events are not easily recoverable or [Replayable](/docs/guides/what-is-replay). Assume that transformed data cannot be recovered.
26
29
-**Device-mode destinations are NOT supported:** Source scoped transformations will **only** apply to cloud-mode destinations, warehouses, and S3 destinations. Destination scoped transformations will **only** apply to cloud-mode destinations.
27
30
28
31
## View all Transformations
29
32
30
33
All Protocols Transformations are listed in the Transformations tab in the Protocols section. The list view supports filtering and sorting to organize transformations by transformation type, source, and destination.
31
34
32
-

35
+

33
36
34
37
Transformations can be enabled and disabled directly from the list view using the toggle.
35
38
@@ -43,11 +46,11 @@ To create a Transformation, navigate to the Transformations tab in Protocols and
43
46
> Workspace Owner or Source Admin permissions are required to create and edit transformations.
44
47
> Source Read-only permissions are required to view transformations.
45
48
46
-

49
+

47
50
48
51
### Step 1: Select the transformation type
49
52
50
-
To create a Transformation, you first need to select which type of transformation you want to create. For each transformation type, Segment displays a description, use cases and example payload. Current transformation types include:
53
+
To create a Transformation, you first need to select which type of transformation you want to create. For each transformation type, Segment displays a description, use cases, and example payload. Current transformation types available in your Segment workspace include:
51
54
52
55
**Rename track event:** Rename track event name at the source or per destination
@@ -58,6 +61,9 @@ To create a Transformation, you first need to select which type of transformatio
58
61
**Edit identify or group event traits:** Rename multiple traits and/or change trait data structure at the source or per destination
59
62

60
63
64
+
> success ""
65
+
> View more [use cases](#use-cases) of Transformations available in both your workspace and [Segment's Public API](https://docs.segmentapis.com/tag/Transformations){:target="_blank"}.
66
+
61
67
### Step 2: Set up the transformation
62
68
63
69
Depending on the transformation type you selected, relevant drop-down selectors and fields are presented to define how you want to transform the data.
@@ -67,12 +73,12 @@ Depending on the transformation type you selected, relevant drop-down selectors
67
73
68
74
Regardless of the type of transformation selected, first select a source. Each Transformation can only apply to a single source. While this makes it more difficult to apply transformations broadly, it ensures you are only transforming data relevant to the selected source.
69
75
70
-
After selecting the source, you will need to select a scope. Scope determines where the transformation will be applied.
76
+
After selecting the source, you will need to select a scope. Scope determines where Segment applies the transformation.
71
77
72
78
> warning ""
73
79
> Source-scoped Transformations only apply to cloud-mode, S3, and data warehouse destinations.
74
80
75
-

81
+

76
82
77
83
***Source scope:**
78
84
Events are transformed in all **active Segment cloud-mode destinations, warehouses, and S3 destinations.** This scope is best when you want to fix malformed events before sending them to all destinations. These transformations should be treated as a temporary solution to hold you over while your engineering team fixes the root event.
@@ -86,12 +92,34 @@ Depending on the type of transformation you selected, you will need to enter the
86
92
After you select the scope, use the search box to choose the event to transform. You can **only** select a single track event, identify or group call. If you are renaming the event, simply enter the new name in the provided text field.
87
93
88
94
***Rename properties or traits:**
89
-
If you rename properties or trains within a selected event, click **+ Add Property**. The dropdown that appears contains the properties or traits sent with the selected event. Segment supports JSON Path notation to select nested objects up to four levels deep. For example, `order.id` selects the `id` property in the `order` object. Segment does not support `.$.` notation to select a property from an array of objects.
95
+
If you rename properties or traits within a selected event, click **+ Add Property**. The dropdown that appears contains the properties or traits sent with the selected event. Segment supports JSON Path notation to select nested objects up to four levels deep. For example, `order.id` selects the `id` property in the `order` object. Segment does not support `.$.` notation to select a property from an array of objects.
90
96
91
97
After selecting a property/trait, select JSON Path or Simple String to change the property/trait. Simple string will change the name in-line, while JSON path allows you to move the property/trait in or out of an object.
92
98
93
99
### Step 3: Name the transformation and enable it
94
100
95
101
Enter a descriptive name to act as a label for the transformation. This label helps you organize your Transformations, and Segment recommends that you make this descriptive and focused on the problem you're solving. For example `Fix misnamed order_completed event for ecommerce spec` is much better than `Map order_completed`.
96
102
97
-
In this step, you can also choose to keep the Transformation disabled, so you can and come back and edit it later. To update, enable, or disable a Transformation, click on the overflow menu and select **Edit Transformation**.
103
+
In this step, you can also choose to keep the Transformation disabled, so you can come back and edit it later. To update, enable, or disable a Transformation, click on the overflow menu and select **Edit Transformation**.
104
+
105
+
## Use Cases
106
+
107
+
Here's a list of Segment Transformations with some use case examples.
108
+
109
+
-**Rename an event:** Change an event name from `viewed_product` to `Product Viewed`.
110
+
111
+
-**Rename a property or trait:** Change the property name `revenue` to `total` for a specific destination.
112
+
113
+
-**Update a property value:** Use [Segment's Public API](https://docs.segmentapis.com/tag/Transformations){:target="_blank"} to transform the property `currency` to have the value `USD`. This transformation is in beta.
114
+
115
+
-**Add a new property name and assign a value:** If you want to create a new property and set a static value, use [Segment's Public API](https://docs.segmentapis.com/tag/Transformations){:target="_blank"} to create `new_property: static_value`. This transformation is in beta.
116
+
117
+
{% comment %}
118
+
-**Change property value casing:** Transform property value casing to lowercase, uppercase, or title case. For example, Transform the property value `united states` to `USA` to remain consistent with your data tracking.
119
+
{% endcomment %}
120
+
121
+
> info ""
122
+
> Segment displays an error if the following property conflicts occur:
123
+
> - You create a property value transformation when one already exists for the same property value.
124
+
> - Two property paths in `propertyValueTransformations` are the same.
125
+
> - A property path in `propertyValueTransformations` is the same as a property name in `propertyRenames`.
0 commit comments