Skip to content

Commit 7209741

Browse files
authored
Merge pull request #3874 from segmentio/Advanced-Transformations
Advanced Transformations beta updates
2 parents 4be15a1 + 03a7f6c commit 7209741

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

src/protocols/transform/index.md

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ redirect_from: '/protocols/transformations/'
77

88
## What is a Transformation?
99

10-
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+
1114

1215
**Transformations are very powerful and should be applied with care!**
1316

@@ -21,15 +24,15 @@ Segment's goal is to make Transformations a powerful tool that complements a wel
2124
### Other important notes
2225

2326
- **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.
2528
- **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.
2629
- **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.
2730

2831
## View all Transformations
2932

3033
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.
3134

32-
![](../images/transformation_list_view.png)
35+
![view all Transformations in your Segment workspace](../images/transformation_list_view.png)
3336

3437
Transformations can be enabled and disabled directly from the list view using the toggle.
3538

@@ -43,11 +46,11 @@ To create a Transformation, navigate to the Transformations tab in Protocols and
4346
> Workspace Owner or Source Admin permissions are required to create and edit transformations.
4447
> Source Read-only permissions are required to view transformations.
4548
46-
![](../images/transformation_wizard.png)
49+
![create a transformation with the three-step wizard](../images/transformation_wizard.png)
4750

4851
### Step 1: Select the transformation type
4952

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:
5154

5255
**Rename track event:** Rename track event name at the source or per destination
5356
![rename track event](../images/event-rename-example.png)
@@ -58,6 +61,9 @@ To create a Transformation, you first need to select which type of transformatio
5861
**Edit identify or group event traits:** Rename multiple traits and/or change trait data structure at the source or per destination
5962
![edit identify or group event traits](../images/traits-example.png)
6063

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+
6167
### Step 2: Set up the transformation
6268

6369
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
6773
6874
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.
6975

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.
7177

7278
> warning ""
7379
> Source-scoped Transformations only apply to cloud-mode, S3, and data warehouse destinations.
7480
75-
![](../images/transformation_scope.png)
81+
![select a transformation scope](../images/transformation_scope.png)
7682

7783
* **Source scope:**
7884
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
8692
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.
8793

8894
* **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.
9096

9197
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.
9298

9399
### Step 3: Name the transformation and enable it
94100

95101
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`.
96102

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

Comments
 (0)