Dimension rules consist of two main parts, the 'when' part, which specifies which rows the rule applies to, and the ‘then’ part of the rule, which specifies what the result of the rule should be. In the rules below the 'then' is bold:
- If data source type is Facebook then traffic source is set to “facebook”.
- If campaign is not empty then Tactic is the value of campaign.
Funnel gives you a range of tools for managing the 'then' part of your rule, and thereby deciding what the result of the rule should be.
Setting a rule result
There are three ways to get the initial rule result:
- Enter a text value yourself
- Get the value of a dimension
- Get the result of the regular expression used in your rule.
The rule below will return traffic source “Twitter” for all Twitter data.
Value of a dimension
The rules below combine data from dimension ‘Campaign’ from a file upload with data from dimension ‘Ad Group Name’ from Bing into a new dimension called My Campaign:
- source 'Other (File Upload)', Campaign 'shirts' = 'shirts'
- source 'Other (File Upload', Campaign 'hats' = 'hats'
- source 'Bing', Ad Group Name 'hats' = 'hats'
You can use a regular expression to find matching rows in your data. You can also use the same regular expression to set the value, in other words extract the matching part of the data and use it as the result. This works if your regular expression has a capture group, for instance the rule below:
Will result in:
- Campaign 'td_se_shirts' = 'shirts'
- Campaign 'fb_se_hats' = 'hats'
Manipulating the rule results
Once you have your initial dimension rule result you can manipulate it in a number of ways:
- Append another value to it,
- Truncate the value,
- Replace characters in it,
- Convert the value in various ways (see below).
You can chain these functions together, for instance you can:
Set to “td_se_” → append value of “Ad set” → convert to lowercase → append “_display”
Add a new value to the end of the current value. The new value can be text you enter yourself, the value of another dimension, or the result of a regular expression in your rule.
You can use this to, for example, concatenate two dimensions, like this:
This would result in:
- source 'display', medium 'cpc' = 'display_cpc'
- source 'google', medium 'organic' = 'google_organic'
Shortens the value to the first X characters, so for instance truncating ‘Apples and pears’ to first 10 chars becomes ‘Apples and’.
Converts the entire value using one of the methods below.
- To Lowercase - Converts the entire value to lower case, e.g. ‘Apples And Pears’ becomes ‘apples and pears’.
- To uppercase - Converts the entire value to upper case, e.g. ‘apples And pears’ becomes ‘APPLES AND PEARS’
- Capitalize - Converts the first letter of the value to upper case and the rest to lower case, e.g. ‘apples And Pears’ becomes ‘Apples and pears’.
- Trim whitespace - Removes spaces, tabs and other whitespace from the beginning and end of the value, e.g. ‘ apples and pears ‘ becomes ‘apples and pears’.
- Unescape - Unescape escaped HTML characters, e.g. ‘apples & pears’ becomes ‘apples & pears’.
Replace characters in the value with other values. For example replacing ‘+’ with ‘ ’ will turn ‘hats+UK’ into ‘hats UK’.
Like ‘replace’ but uses a regular expression to match the characters to be replaced, for instance replacing /^(SWE|sv|SV)/ with ‘se’:
- value 'SWE_marketing_shirts' = 'se_marketing_shirts'
- value 'sv_hats' = 'se_hats'
- value 'us_black-friday_shoes' = 'us_black-friday_shoes'