Overview
Custom Dimensions in Polar Analytics give you powerful control over how you segment and categorize your data. By using a combination of operators and functions, you can create dynamic, rule-based groupings tailored to your business needs.
This guide explains:
What operators and functions are available
How to format them correctly
Real-world examples to help you apply them effectively
Extended Custom Dimension tutorial
Custom Dimension Logic
When building a Custom Dimension, you’ll work with three key components:
When – The condition that triggers the rule.
Then – What value to return if the condition is met.
Else – What value to return if no conditions are met.
Each When block can include multiple conditions, which you can combine using:
AND – All conditions must be true for the rule to apply.
Example:
Country is "US"
ANDDevice is "Mobile"
→ applies only to mobile users in the US.OR – At least one condition must be true for the rule to apply.
Example:
Country is "US"
ORCountry is "CA"
→ applies to users from either the US or Canada.
You can mix and match these to create complex, targeted logic.
Custom Dimension Operators
Operators define how a dimension value is compared against a condition.
Operator | Description | Example |
| True if the dimension includes a specific value |
|
| True if the dimension excludes a value |
|
| Same as |
|
| Case-sensitive exclusion |
|
| Exact match |
|
| Excludes exact match |
|
| Matches a beginning value |
|
| Matches an ending value |
|
| Matches one of several values |
|
| Excludes all values in the list |
|
Custom Dimension Functions
📝 Text Functions
Text functions help you transform or extract information from text-based dimensions like SKUs, product titles, tags, UTM parameters, and more. These functions are especially useful when you want to clean up, shorten, or isolate certain parts of a text string for clearer analysis and reporting.
Left - Returns the leftmost characters of a string.
Left - Returns the leftmost characters of a string.
Format: Left(value, length)
value
: The dimension/text you want to shorten (e.g. a SKU, title, or URL).length
: The number of characters to keep from the start.
Example: Left(SKU, '4')
→ PREM-123456
→ PREM
In the example below, we're splitting the SKU dimension so that any SKU containing a hyphen "
-
" only returns the first 12 characters:
Right - Returns the rightmost characters of a string.
Right - Returns the rightmost characters of a string.
Format: Right(value, number)
value
: The dimension/text you want to shorten (e.g. a SKU, title, or URL).length
: The number of characters to keep from the start.
Example: Right(SKU, '4')
→ PREM-1234
→ 1234
Lower - Converts all text to lowercase.
Lower - Converts all text to lowercase.
Format: Lower(value)
value
: The dimension you want to convert
Example: Lower(Country Code)
→ "RO" becomes "ro"
Upper - Converts all text to uppercase.
Upper - Converts all text to uppercase.
Format: Upper(value)
value
: The dimension you want to convert
Example: Upper(Campaign Name)
→ "summer sale" becomes "SUMMER SALE"
In this example, we created a function that will return any campaign names that contain "Au" as uppercase. All other campaigns will return their default name.
Concat - Combines two dimensions or strings.
Concat - Combines two dimensions or strings.
Format: Concat(value1, value2)
value1
: The first dimension or text string you want to pull invalue2
: The second dimension or text string you want to pull in
Example: Concat(Country Code, Zip Code)
→ "IL" + "90210" → "IL90210"
Replace - Replaces a dimension or string of text with a defined value or dimension
Replace - Replaces a dimension or string of text with a defined value or dimension
Format: Replace(subject, pattern, replacement)
subject
: The dimension you want to targetpattern
: The substring that you want to replacereplacement
: The value used as a replacement
Example: Replace(Product Title, 'Trial', 'Standard')
→ "Trial Kit"
becomes "Standard Kit"
Split Part - Splits a dimension or a string of text into parts using a delimiter and returns the selected part.
Split Part - Splits a dimension or a string of text into parts using a delimiter and returns the selected part.
Format: Split_part(string, delimiter, partNumber)
string
: The dimension or text to be split into partsdelimiter
: The text representing the delimiter to split bypartNumber
: The requested part of the split (starts at 1)
Example: Split_part(SKU, '-', '2')
→ "PREM-01-GOLD"
returns "01"
📅 Date Functions
Date functions let you manipulate and extract specific parts of a date, such as the year, month, or day. You can use them to group data by time periods, compare time-based behaviors, or create custom labels for cohorts or timelines.
When using date functions, you need to specify which date to use. This will typically be a dimension like:
Date
→ the shared date dimension that automatically uses the date range selected in your report.Customer First Order Date
,Order Processed Date
, etc. → specific dimensions from your data.
Week / Month / Quarter / Year - Assigns a number to the week, month, quarter, or year.
Week / Month / Quarter / Year - Assigns a number to the week, month, quarter, or year.
Format: Week(date)
/ Month(date)
/ Quarter(date)
/ Year(date)
Example: Week(Date)
→ "2022-04-10"
→ 15
Day Name - Returns the name of the weekday.
Day Name - Returns the name of the weekday.
Format: DayName(date)
Example: DayName(Date)
→ "Tuesday"
Day of Week - Returns a number from 0 (Sunday) to 6 (Saturday).
Day of Week - Returns a number from 0 (Sunday) to 6 (Saturday).
Format: DayOfWeek(date)
Example: DayOfWeek(Date)
→ "2022-04-10"
→ 0
(Sunday)
Date Diff - Returns the difference between two dates.
Date Diff - Returns the difference between two dates.
Format: Datediff(date_part, date1, date2)
date_part
: The unit of time (year, month, day, quarter)date1
: The first value to comparedate2
: The second value to compare
Example: Datediff('day', Processed date, Updated day)
→ "2022-01-01"
and "2022-01-10"
= 9
🔍 Advanced Pattern Matching
Pattern matching functions allow you to detect or replace specific characters, symbols, or patterns in text. These are useful when working with structured text (like SKUs or tags) or when you need to find certain words or values across your data. They're especially powerful for cleaning, standardizing, or categorizing data dynamically.
Regexp - Extracts text based on a regex pattern.
Regexp - Extracts text based on a regex pattern.
Format: Regexp(subject, pattern)
subject
: The dimension or string on which you want to apply the regexpattern
: The regular expression or the text that precedes the string you want to extract followed immediately by([^"]*)
Example: Regexp(Order Line Properties, '{"name":"Color","value":"([^"]*)')
-> Extracts "Blue"
from: [{"name":"Color","value":"Blue"}]
⚠️ Tip: If copying ([^"]*)
, ensure your quotation marks stay straight quotes ("
) and not curly quotes (“”
) — some browsers may auto-format them incorrectly.
Examples
Analyze Total Sales by Day of the Week
If you'd like to break down your Total Sales by the day of the week they were processed (to identify your highest sales days over a given period), you can use a Custom Dimension like this:
📌 What this does:
If there's a valid
Order Processed Date
, it returns the day of the week (e.g. Monday, Tuesday).If no date is available, it returns
"No Data - Extend date range"
as a fallback.
Note: The specific date range rule applied to the Order Processed Date
doesn’t matter much—what’s important is that your report covers a wide enough date range to include meaningful data.
Once this Custom Dimension is created, add it as a breakdown in a Custom Report alongside Total Sales. You’ll instantly see which days drive the most revenue.
📊 Example Insight:
In the sample report below, Saturdays had the highest Total Sales, while Tuesdays had the lowest—helping you identify weekly patterns and plan accordingly.
Add Labels to Week Numbers Using Concat
If you want to track performance by week, labeling your weeks clearly can help you compare trends more easily across months or years.
For example, if you're analyzing sales or sessions on a weekly basis, adding a prefix like "W-"
to your week numbers makes charts and tables easier to read and interpret at a glance.
You can do this using the Concat
function:
Concat ('W-', Week (Date))
→"2022-04-10"
→W-15
📌 What this does:
Week((Date))
pulls the week number from a date (e.g."2022-04-10"
becomes15
).Concat("W-", ...)
adds the"W-"
prefix to make the output easier to interpret in your reports.
📊 Tip: This kind of labeling is especially helpful when visualizing data by week in bar charts or tables—clearer labels make insights easier to spot.