Create Transformations

Add and test a new transformation in RudderStack.

This guide will help you add a new transformation in the RudderStack dashboard. It also contains the steps to capturing any event-related information in your transformation using the log function.

Add new transformation

  1. Log in to the RudderStack dashboard.
  2. Go to Collect > Transformations and click Create Transformation.
  3. Choose a transformation template for implementing specific use cases on your event data. To create a transformation from scratch, click Custom transformation.
Custom transformation option
  1. Name your transformation. It must contain at least 2 characters.
Name your  transformation
  1. In the Transformation window, select the language to write your transformation. RudderStack provides two options - JavaScript and Python 3.11.
RudderStack supports Python transformations only in the RudderStack Cloud Growth and Enterprise plans.
  1. Add your transformation function. You can also add other functions and call them from within the transformEvent function.
Adding a Transformation
  1. To test your transformation, import a payload using the Import event button. Then, click the Run Test button next to it.
If you don’t import any event and click Run Test directly, RudderStack tests your transformation against a default track event payload.
Import event and run test
  1. To save the transformation, click the Save Transformation button at the bottom right.

Optional: To switch between the portrait and landscape views for better readability, click the button next to Save Transformation.

Switch between portrait and landscape views

Test transformation

RudderStack lets you test your transformations to identify and prevent any transformation errors. With this feature, you can thoroughly test various scenarios and edge cases on your event payloads, and ensure effective event processing within RudderStack.

Import event payload

To import a test payload, click the Import Event button.

Import event and run test

RudderStack gives you the following options to test your transformations:

  • Use sample/placeholder event data within the RudderStack Events tab to test your transformations on default RudderStack event payloads. This is helpful when you don’t have any live events in your workspace.
  • Edit an event payload and save it as a new event. You can then use it to test your transformation.
  • Use the Live Events feature to test your transformations on live events generated from your source.


  • You cannot import multiple sample events to test your transformation.
  • The live events contain payloads present at the source. They do not resemble the enriched events you see in the Live Events viewer in your transformation.

Capture event information with logs

Once you add a transformation, you can capture any event-related information in the form of logs while testing it. You can do this by including the log function in your transformation code, as shown:

On adding the above transformation and clicking Run Test, you can see the resulting log in the Logs section of the dashboard:

Transformation log
You can pass a string, number, or an object as an argument to the log function.

Questions? Contact us by email or on Slack