While Properties provide the raw data and settings, Functions allow you to perform specific calculations, retrieve dynamic values, or implement conditional logic within your Segments.
What are Functions?
Functions are predefined operations identified by a name followed by parentheses (). Some functions require arguments (inputs) inside the parentheses, while others do not. They perform a specific task and typically "return" a value that can be used in your expressions or assigned to variables.
Key Functions Available
Here's an overview of the main types of functions available in the Formulas syntax:
Date/Time Functions
now()
Returns the current timestamp, represented as seconds since Unix epoch. Essential for comparing timestamp properties (like last bid change) to the present.
interval(Xd)
Converts a Time Period value (like 7d, 30d, or a variable holding a Time Period value) into an internal representation of a duration, stored as a total number of seconds corresponding to that period. This duration value is used primarily for timestamp arithmetic (e.g., now() - interval(7d)).
Conditional Logic Functions
case(...)
Allows you to implement if/then/else style logic. It evaluates conditions and returns a specific value based on the first true condition.
Learn more about Conditional Logic
Variable Definition
let
While not a traditional function call, the let keyword is used to define variables (Custom Properties).
Learn more about Creating Custom Properties
How to Use Functions
You integrate functions into your expressions just like properties or values:
// Using now() and interval() for a date comparison last bid change < now() - interval(14d)
// Using case() to determine a value let $bid_adjustment = case( acos(30d) > 50% => 0.8, else 1.0);
// Using the result of case() later
bid > cpc(14d) * $bid_adjustment // Use the calculated adjustmentFunctions significantly enhance the power and flexibility of your Segments, enabling dynamic comparisons and complex conditional rules.
For detailed syntax, examples, and return types for each function, please consult the filterable Syntax Reference.