Open navigation

How to add multiple transformation steps to custom fields

With custom fields, you can add multiple transformation steps to unlock advanced data manipulation opportunities. By layering functions, lookups, and conditions, you can create complex rules for manipulating your data and conduct in-depth analysis with deeper insights. 


Use cases for adding multiple transformation steps include:

  • Data enhancement with functions and lookups: Suppose your campaign names include a product category, but you wish to analyze performance by category. You can use a function to extract the category from the campaign name, then a lookup to map category codes to full category names. This enables you to evaluate performance by product category instead of individual campaigns.
  • Performance metric calculation and categorization: You can calculate the cost per click (CPC) and categorize it as 'High', 'Medium', or 'Low'. Start with a function to calculate CPC (Ad Spend / Clicks), then add a condition to categorize the CPC based on your thresholds.
  • Data clean-up and transformation: If your ad campaigns are missing key information, like the target country, a function can fill the missing country values with 'Not Specified'. Then, add a lookup transformation to convert the country codes to full country names, followed by a condition to flag campaigns targeting high-priority countries.
  • Data enrichment for advanced analysis: Maybe you need to transform your ad spend into another currency, round to the nearest dollar, and flag any campaigns with spend over a set threshold. First, use a function to apply the currency conversion, add another function to round the result, and finally a condition to flag high-spending campaigns.

See this article for a full list of available functions.


Instructions

  1. On the Supermetrics Hub, go to Transformations → Custom fields.
  2. Click Create new custom field.
  3. Select either dimension or metric and click Next.
    This selection is based on the aspect of the data you aim to manipulate.
  4. Select the data source you want to apply a transformation to and click Next.
  5. Select your first transformation — function, lookup, or condition.
  6. After you've configured your initial transformation, click Add another transformation. This allows you to apply another transformation to the result of the previous step.
    1. Select the type of your next transformation and configure it as necessary. 
    2. Click Add another transformation to continue adding transformations until you’ve created the custom field you need.
    3. When done, click Next
  7. Give your custom field a name.
  8. Click Create custom field.

You can now use your new custom field in your reporting.

Practical example

Let's set up a custom field to see the sessions for your Google Ads and Facebook Ads campaigns. In this example, all Google Ads campaigns start with a G and all Facebook Ads campaigns start with an F. In our report, we'd like all Google Ads campaigns to be labeled as originating from Google and all Facebook Ads campaigns as originating from Facebook.


To achieve this, we need two transformations. Here's what to do:

  1. Create a new custom field and make it a dimension.
  2. Select the Google Analytics data source.
  3. Create the first transformation that identifies the first letter of the campaign name:
    1. Select Function, and select the Split text and pick part function.
    2. Select the Session campaign name field as the input text.
    3. Set delimiter as underscore, and set the part number as 1.
    4. Click Add another transformation.
  4. Create the second transformation that uses the result from the previous step to return the full name of the platform from which the data originates:
    1. Select Lookup.
    2. In the Options, select to Return new value if data EQUALS lookup value.
    3. In the lookup table, set the values to look up and return. In this case, we want the lookup value G to return Google and lookup value F to return Facebook.
    4. Name your custom field and save it.
  5. Go to your data destination or set up a query or a transfer.
    1. Select the Google Analytics data source.
    2. Select the accounts and date range you want to pull data for.
    3. Select the newly created custom dimension.
    4. Select the Sessions metric.
    5. Run the query.

The results show your data grouped by either Google, Facebook, or others.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.