How target evaluation works
mastersearchType and searchTarget, the plugin will either track the mere occurrence of a target or extract the specific value attached to or embedded within that target.repository·master·Indexed 24 days ago
https://github.com/pyrochlore/obsidian-trackerA plugin for the Obsidian note-taking app that aggregates data from notes via frontmatter or inline fields and visualizes it using calendars, graphs, charts, and tables. It supports various search types including tags, Dataview fields, and regex patterns, and provides a powerful expression system for data processing and statistical summaries.
searchType and searchTarget, the plugin will either track the mere occurrence of a target or extract the specific value attached to or embedded within that target.Obsidian Tracker collects data by reading YAML-formatted code blocks. To successfully collect data, you must provide at least two parameters: searchType and searchTarget.
Supported searchType values include:
tagfrontmatterfrontmatter.existsfrontmatterlistwikidvFieldtablefileMetatasktextThe searchTarget must be provided according to the specific type selected in searchType.
Since version 1.3.0, you can store multiple values in a single target separated by a slash (e.g., #bloodpressure:180/120mmHg). To access a specific value from this tuple, use bracket notation with the numeric index.
Note: This numeric index notation is distinct from the bracket notation used in searchType: frontmatterlist, which uses brackets to match a string value against a list.
You can customize the separator using the separator parameter.
The Obsidian Tracker plugin supports searching for content within WikiLinks (e.g., [[link|display]]) using two specific searchType values:
wiki.link: Targets the actual link destination (the part before the pipe |).wiki.display: Targets the display text (the part after the pipe |).wiki: A fallback type that attempts to parse the display text first, and if no display text exists, parses the link text.Example WikiLink structure:
[[todo_family|To-Do @Family]]
todo_familyTo-Do @FamilyThe tracker code block allows you to collect and summarize task data within Obsidian. You can control which tasks are collected using the searchType parameter:
task: Collects all tasks matching the searchTarget.task.all: Collects all tasks matching the searchTarget (alternative syntax).task.done: Collects only completed tasks matching the searchTarget.task.notdone: Collects only incomplete tasks matching the searchTarget.task.done, task.notdone).searchType: task.done
searchTarget: Say I love you
folder: diaryTo display collected data, you must provide at least one output parameter in your YAML code block. The plugin supports the following output types:
line or bar: Generates customizable charts to visualize variations in collected numbers over time.summary: Creates a text block based on a template parameter. You can use expressions like {{sum()}} or {{maxStreak()}} within the template to generate statistical summaries.bullet: Creates a bullet chart, useful for showing status, levels, performance, or progress as a gauge.month: Creates a monthly view that circles dates exceeding a specific threshold and displays streaks.pie: Creates a pie chart. This requires the data parameter for sectors, label and extLabel for displaying labels, and dataName for legend display names.Tracker does not require file names to contain dates, but it always requires a date source for X values. If your notes do not use date-based file names, you must specify an alternative source using searchType and searchTarget, and then mark that source as the X dataset by setting the xDataset parameter to its index.
If you have no explicit date fields, you can use the file's metadata as a fallback:
cDate: Creation datemDate: Modification dateTo use these, set the searchType to fileMeta and the searchTarget to either cDate or mDate.
In Tracker, missing values (null values) are ignored by functions like sum() or average(). However, performing arithmetic on a missing value (e.g., value + missing_value) will result in a missing value.
To prevent this, you can:
penalty parameter in your tracker configuration to assign a default value to missing data.setMissingValues(Dataset, number) expression function to explicitly replace nulls within an expression.Example:
{{sum(setMissingValues(dataset(1), 0))}} replaces all missing values in dataset 1 with 0 before summing.
You can perform arithmetic operations within the summary.template using double curly braces {{ ... }}. The plugin supports operations between numbers and datasets, as well as between two datasets.
Direct arithmetic on numbers:
number + number
Performing arithmetic on a dataset results in a new dataset where the operation is applied to each element:
Dataset + numberDataset - numberDataset * numberDataset / numberDataset % number (modulo)Adding two datasets results in a new dataset where each element is the sum of the corresponding elements from the two datasets:
Dataset1 + Dataset2 (where Dataset[i] = Dataset1[i] + Dataset2[i])
Note: Use the dataset(index) function to reference specific datasets in complex expressions.
searchType: dvField
searchTarget: dataviewTarget
folder: /diary
startDate: 2021-01-01
endDate: 2021-01-03
summary:
template: 'Maximum value: {{max() * 2::i}}'The plugin has specific behaviors when encountering malformed Markdown tables or invalid data:
Tracker supports two methods for providing array-style input:
['value1', 'value2', 'value3'].value1, value2, value3. You can also wrap this list in single quotes: 'value1, value2, value3'.The frontmatterlist search type allows you to track multiple distinct values (targets) that are stored within a single YAML property (e.g., a list of habits). The plugin searches the frontmatter for the specified property and checks if the list contains the value provided in the searchTarget using the syntax propertyName[value].
Key behaviors:
yoga will match yoga, Yoga, or YOGA in your frontmatter.habits: [yoga, piano]), empty lists (habits: []), and multi-line lists:habits:
- yoga
- spanishsearchType: frontmatterlist
searchTarget: habits[yoga]
folder: diary
startDate: 2026-02-01
endDate: 2026-02-28
datasetName: Yoga
month: