With liquid filters you can build metrics and dimensions in the Definitions Layer which you can then use in your Dashboards.
Common Questions
how can I filter my customers for new and returning customers? or even more granular: new, returning, loyal, superfan?
how can I create a new sessions KPI?
Available Liquid Filters
We support every generic liquidjs filter there is.
Generally speaking, the most useful filters are our custom liquid filters / window functions:
Last Value: attribute_last_value_by_attribute
First Value: attribute_first_value_by_attribute
Sum: attribute_total_sum_by_attribute
Count: attribute_total_count_by_attribute
Count Distinct: attribute_total_unique_count_by_attribute
You can use those filters within the Definitions Layer to format data or create logic on top of certain data.
Use Case Examples
1. Dashboard Filter: Create Dimension for Customer Segment based on Order Count
In this specific example we look to build a logic that differentiate between new and returning customers or in more detail:
New Customer = 1 Order
Returning Customer >=2 Orders
Loyal Customer >=3 Orders
Superfan >=5 Orders
You can build this logic under "Definitions" > "Conversions" > "Attributes" with the Configuration set to "Formula":
CASE
WHEN {{ attributes.shopify_order_id | adtribute_first_value_by_attribute: attributes.identity, attributes.shopify_order_processed_datetime }} = {{ attributes.shopify_order_id }}
AND {{ attributes.conversion_key }} = "custom_conversion_definition_shopify_order"
THEN "New Customer"
WHEN {{ attributes.conversion_key }} = "custom_conversion_definition_shopify_order"
AND {{ attributes.shopify_order_id | adtribute_total_unique_count_by_attribute: attributes.identity }} = 2
THEN "Returning Customer"
WHEN {{ attributes.conversion_key }} = "custom_conversion_definition_shopify_order"
AND {{ attributes.shopify_order_id | adtribute_total_unique_count_by_attribute: attributes.identity }} >= 3
AND {{ attributes.shopify_order_id | adtribute_total_unique_count_by_attribute: attributes.identity }} < 5
THEN "Loyal Customer"
WHEN {{ attributes.conversion_key }} = "custom_conversion_definition_shopify_order"
AND {{ attributes.shopify_order_id | adtribute_total_unique_count_by_attribute: attributes.identity }} >= 5
THEN "Superfan"
END
It would look like this in the App and you could use it as Filter within the Dashboards after saving.
2. Dashboard Metric: New Sessions KPI
You can create a New Sessions KPI under "Definitions" > "Touchpoints" > "Attributes" with the Configuration set to "Formula":
CASE WHEN {{attributes.id}} = {{attributes.id | attribute_first_value_by attribute: attributes.identity, attributes.event_datetime }}
THEN 1
ELSE 0
END
It would look like this in the App and you could use it as a Metric within the Dashboards after saving.
Note: You can use these Liquid Filters to format and build logic on top of existing data to create metrics and filters that suit your needs. If you have an idea for a custom metric or filter but do not know how to set it up yourself, feel free to reach out to us!