Stape
Search
Try for free

What are Transformations in server Google Tag Manager

Updated
Sep 10, 2024
Published
Jul 18, 2023
Also available in

One of the biggest releases in 2023 in server Google Tag Manager is Transformations. It adds a whole new object to the current structure of sGTM. Transformations act with clients and tags and add a new ability to override or add event data after the client processes incoming HTTP requests and before a tag can access the event data. 

In this blog post, I want to focus on what Transformations are, how to set them up, and what are the most common use cases. 

What are transformations

A transformation is an object in the server Google Tag Manager that acts as an intermediary between the client and the tag. 

Data is delivered to the server Google Tag Manager container as an incoming HTTP request. Once a client claims a request, it restructures a request into event data that tags, triggers, or variables can use in sGTM.  

Transformations allow adding, excluding, and modifying event parameters after the client parses an incoming HTTP request before the tag can access it. 

Each transformation consists of the following:

  1. Configuration. This is where you define what needs to be done with data (allow parameters, augment event, exclude parameters)
  2. Matching condition. Defines in which cases transformation will work. This is very similar to triggers in tag configuration.
  3. Affected tags. Here you need to select which transformation will apply from the list of existing tags. 
transformations in server google tag manager

Types of Transformations

There are three types of rules that transformations allow for creating. After applying the transformation rule, it modifies event data for the selected tags and in the specified conditions. Event data is not modified for the default event data. 

transformation types in server google tag manager

1. Allow parameters

The Allow parameter transformation allows defining parameters that only be accessible by tag. Parameters that are not added to the allowed parameter transformation will be discarded. 

Since this transformation highly affects what event data is accessible to tags, ensure you’ve added all required parameters. Otherwise, tags can not fire due to missing event data. 

2. Augment event

Allows adding or modifying event data. When using this transformation, you can override or add any event data before the tag can access it.

3. Exclude parameters

The exclude parameter transformation allows removing any parameter before the tag can access it. Like the allow parameter transformation, check the required parameters for tags first because when the required parameter is missing, the tag won’t be able to trigger. 

How to set up Transformations

1. Go to the transformations tab and click New. 

transformation tabs

2. Select from the list of specified transformation types.

transformation type

3. With Allow or Exclude transformation, you only need to specify the parameter that needs to be allowed or excluded. 

transformation configuration

If you select to augment an event, you must add the parameter you want to modify and the value to which it should be modified. 

How to Debug Transformations

The process of debugging transformation is exceptionally straightforward. As usual, you must open preview and debug mode and trigger the tag with transformation. 

1. Open the tags tab in the sGTM debugger, click on the tag that includes transformation, and you should see the name of the transformation in the Transformations section.

debug transformations

2. Scroll down to the section Modified Event Data. Here you need to enable the checkbox, Show Original. This way, you can see how Transformation affected data that the tag can access. 

debug transformations

3. In my Transformation, I’ve excluded user_agent and ip_override parameters. To verify if data was excluded correctly, I need to verify that in the Final Value, these parameters were excluded. 

debug transformations

Transformations use cases

1. Enrich data. 

With Augment transformation, you can enrich the data of any tag. It can be advantageous to add any data from your database, for example, additional product or user data. 

2. Remove PII or any sensitive data. 

To comply with data protection requirements in some countries, it is required to remove any sensitive PII before sending it to any analytics or tracking tool. 

With the help of Allow or Exclude parameter transformation, you can strictly control the data sent to each vendor.  

3. Write precise data to a database. 

Using allow data transformation, you can write clear data to Bigquery, Firestore, or any database you use to collect data. 

Conclusion

A transformation is an easy-to-use tool that allows strictly control of what data each tag can access. It provides possibilities to two opposite options: from one side, staying compliant by limiting information tags can access. On the other side, it helps to enrich data.  It really depends on the type of project and where you want to implement it. We hope this article was useful and has inspired you to explore the exciting possibilities Transformations offers. 

Tagged with:gtm server

Try Stape for all things server-sideright now!