-
Notifications
You must be signed in to change notification settings - Fork 6
Home
This page is designed to include detailed information on the sample user transformations included in this repository.
User Transformations is a unique feature offered by RudderStack that allows you to code custom functions to transform your events, as per your use-case or requirement.
The following user transformations are included in this repository:
This transformation takes developer-supplied attribute names along with the values of matching attributes, and replaces them with Xs or a masked representation, as per the developer's choice.
Read more on how you can implement this function for your apps.
If an enterprise generates a large volume of events, but the target analytics destination charges by volume - then only certain samples of event data can be sent to the destination for analytics. This transformation function allows you to:
- Selectively removes events based on a name match
- Selectively removes events based on the value of a given attribute
- Aggregates values of certain attributes for multiple instances of a specific type of event in a batch and then replaces those instances with a single instance containing the aggregated attributes
This user transformation does the following:
- Replaces missing values for a User-Agent attribute
- In cases where the developer has populated crucial attributes within nested structures but not at the root level, copies the values to the root level
- Reduces batch size and then selects only a subset of events
In this transformation, all the attributes within a given event payload which do not have any value are removed to reduce the payload size and optimize the storage space for warehouses.
User Transformation for Filtering by Email Domain, Name Splitting, and Campaign Parameter Extraction
This user transformation does the following:
- Filters out events triggered by users whose email address, if present, is from a particular domain. This can help in filtering out events triggered by users belonging to the enterprise owning the installation. Such users would not really be customers per se, and hence might not be of interest
- If Full Name has been specified for the user, then splits the same into first and last names
- In case of web events, if the URL of the page visited contains UTM information, then the same is extracted and appropriate keys of the canonical object model are populated. These can then be used by subsequent campaign-oriented Destination Transformers, e.g. MailChimp
This transformation is useful for enriching the user data by invoking the Clearbit API and embedding the results within events. In this sample, the Person API of Clearbit is invoked using the e-mail address of the user.
Enrich event data by invoking the IP2Location API and adding the location information corresponding to the event
This transformation does the following:
- Extracts the client-side device, OS and browser names and versions by parsing a User-Agent string present in the event payload
- Adds the above information as JSON structure to the event payload
Note: These transformations can be used as-is, or tweaked depending on your use-case or requirement
Here you can find some useful links related to creating and using your own user transformations in RudderStack.
If you want to know more about user transformations in RudderStack, feel free to contact us or start a conversation on our Slack channel.