View Count

by Trey Wallis
5
4
3
2
1
Score: 51/100

Description

Category: Note Enhancements

The View Count plugin for Obsidian allows you to track and manage the view count of notes within your vault. It provides a way to monitor how often notes are viewed and even analyze trending content. The plugin displays view count data on the status bar and offers a sidebar view for easy navigation. It supports syncing data to the frontmatter for mobile use and allows integration with the Dataview plugin for dynamic queries. With customizable settings, including the type of view count and exclusion of certain paths, users can tailor it to their workflow. Additionally, the plugin offers an API for advanced usage and trending weight calculations over customizable time periods.

Reviews

No reviews yet.

Stats

31
stars
5,142
downloads
5
forks
794
days
594
days
594
days
37
total PRs
0
open PRs
0
closed PRs
37
merged PRs
13
total issues
5
open issues
8
closed issues
175
commits

Latest Version

2 years ago

Changelog

Feature

  • add Skip new notes setting #44

Refactor

  • rename View count type to Count method
  • rename Sync view count to frontmatter to Sync view count
  • rename View count property name to Property name
  • update setting descriptions

README file from

Github

Obsidian View Count

Obsidian Downloads

View count is an Obsidian.md plugin for desktop and mobile. It allows you to track the view count for each file in your vault.

Table of contents

Videos

Basic plugin usage

The sync view count to frontmatter setting

The view count type setting

Installation

  1. In Obsidian, open Settings
  2. Go to Community plugins
  3. Select Browse
  4. Search for View Count by DecafDev
  5. Select Install
  6. Then select Enable

Usage

Once you enable the plugin, view count data will start being tracked. You can see the view count on desktop in the status bar in the bottom righthand corner.

There are 2 types of view count. View count type

If you would like to view the view count on mobile, you will need to enable the Sync view count to frontmatter setting.

View count view

By default, the plugin will add a view to the sidebar called View count. You may access this view by opening the sidebar and clicking on the eye icon.

If the view is not open, you may run Open view count view from the command palette.

There are 2 different lists within the view count:

  • A list of the most viewed notes in your vault sorted in descending order. Click on the eye icon to see this list.

  • A list of the notes with the highest trending weight sorted in descending order. Click on the trending icon to see this list.

Dataview

You may dynamically query view count data using the Dataview plugin

Example 1 - Query view count using Dataview

If you have Sync view count to frontmatter enabled you may query the view count property from the frontmatter of each note.

```dataview
TABLE view-count AS "View Count" SORT view-count DESC LIMIT 10
```

Let's analyze this codeblock:

  1. Render a table using the Dataview Query Language
  2. Query the view-count property in each note
  3. Display that property in a column called "View Count"
  4. Sort the results in descending order (highest to lowest)
  5. Limit the results to 10 notes
```dataviewjs
const plugin = this.app.plugins.plugins["view-count"];
const cache = plugin.viewCountCache;

const TIME_PERIOD = "7-days";

dv.table(["Name", "Trending Weight"],
    dv.pages().sort(p => cache.getTrendingWeight(p.file, TIME_PERIOD), "desc")
        .map(p => [p.file.name, cache.getTrendingWeight(p.file, TIME_PERIOD)])
	        .slice(0,10)
);
```

Let's analyze this codeblock:

  1. Render a table using the DataviewJS
  2. Display 2 columns in the table: "Name" and "Trending Weight"
  3. Query all markdown files
  4. Sort the files based on the trending weight in descending order (highest to lowest)
  5. Format an array of data that includes object with just the file name and the trending weight
  6. Limit the results to 10 notes

The time period can be updated with various values. See the time period section below.

API

The view count plugin exposes an API that can be used to fetch the view count or trending weight for any file.

To start, you need to access the view count cache.

//Get the view count plugin
const plugin = this.app.plugins.plugins["view-count"];

//Get the view count cache
const cache = plugin.viewCountCache;

Then you can use the cache to get a view count or trending weight.

//Get the trending weight
const weight = cache.getTrendingWeight(file, timePeriod);
console.log(weight);
//output: 22

//Get the view count
const viewCount = cache.getViewCount(file);
console.log(viewCount);
//output: 5

Here are the typescript definitions for these functions:

getViewCount: (file: TFile) => number;
getTrendingWeight: (file: TFile, timePeriod: TimePeriod) => number;

Time period

The getTrendingWeight function accepts a time period.

Here are the options:

Value Description
3-days The last 3 days
7-days The last 7 days
14-days The last 14 days
30-days The last 30 days
today The start of the current day
week The start of the week i.e. Sunday
week-iso The start of the iso week i.e. Monday
month The start of the month e.g. January 1

Settings

Count method

The method used to calculate view counts. This can be the total number of times a file has been opened or the unique days a file has been opened.

For example, consider a user that opened a file 3 times in 1 day. Using Total times opened the view count would be 3. However, using Unique days opened the view count would be 1.

A unique day is considered an opening of a file after 12 am local time.

Excluded paths

The folder paths that should be excluded from view count tracking. Please separate individual paths by commas e.g. folder1,folder2

Sync view count

The view count for all files is stored in a JSON file located in the Obsidian configuration folder e.g. .obsidian/view-count.json. When Sync view count is enabled, the plugin will add a view count property to all notes and continuously update them to match the values stored in the JSON file.

Enabling this setting makes view count visible on mobile devices.

Skip new notes

When enabled, new notes will not have a view count property added upon creation. However, if Sync View Count is enabled, a property will be added when the note is opened.

Property name

The name of the property that the view count will be stored in.

[!WARNING] Please rename the existing view count property before updating this value. You can rename the existing property using the rename option in the All Properties view in the right sidebar.

Templater delay

The time to wait in milliseconds before adding a view count property to a new note. You should increase this value if you're using the Templater plugin and the template applied during new note creation is being overwritten.

License

View Count is distributed under MIT License

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Heatmap Calendar
4 years ago by Richard Slettevoll
An Obsidian plugin for displaying data in a calendar similar to the github activity calendar
Release Timeline
4 years ago by cakechaser
Table to CSV Exporter
4 years ago by Stefan Wolfrum
An Obsidian Plugin that allows to export tables from a pane in reading mode to CSV files.
Habit Tracker
4 years ago by David Moeller
A Plugin to display a Habit Tracker in Obsidian.
Simple Note Review
4 years ago by dartungar
Simple, customizable plugin for easy note review, resurfacing & repetition in Obsidian.md.
Better Inline Fields
4 years ago by David Sarman
Obsidian plugin to enhance Dataview style inline fields
Page Gallery
3 years ago by Nathan Clark
Generates a gallery based on selected page contents.
Double Colon Conceal
3 years ago by Michal Srch
Obsidian plugin to display double colon (i.e. Dataview inline fields) as a single colon for more natural reading experience.
Habit Calendar
3 years ago by Hedonihilist
Monthly Habit Calendar for DataviewJS. This plugin helps you render a calendar inside DataviewJS code block, showing your habit status within a month.
Meld Build
3 years ago by meld-cp
Write and execute (sandboxed) JavaScript to render templates, query DataView and create dynamic notes.
HackerOne
3 years ago by neolex
A plugin to get our hackerone reports data into obsidian
Query all the things
3 years ago by Sytone
Query all your data stored in Obsidian, this plugin allows SQL based queries against the data collections available in Obsidian and Dataview. Output can then be rendered by Handlebars
Bulk Exporter
3 years ago by symunona
Bulk export Markdown filtered, renamed and sorted by front matter metadata into a new structure.
Link Tree
3 years ago by Joshua Tazman Reinier
A sidebar foldable list of Obsidian link hierarchies.
moviegrabber
3 years ago by Leon Holtmeier
obsidian.md plugin to grab data from public movie Databases and make them into a note that can be used with dataview querries
Run
2 years ago by Hananoshika Yomaru
Generate markdown from dataview query and javascript.
Feeds
2 years ago by LukeMT, pashashocky, madx
Magic feeds dataview query for obsidian
Reason
2 years ago by Joshua Pham
Digest your Obsidian notes
Dataview Serializer
2 years ago by Sébastien Dubois
Obsidian plugin that gives you the power of Dataview, but generates Markdown, making it compatible with Obsidian Publish, and making the links appear on the Graph.
Dataview Publisher
2 years ago by UD
Output markdown from your Dataview queries and keep them up to date. You can also be able to publish them.
Pug Templates
2 years ago by Nicholas Wilcox
An Obsidian plugin that enables the usage of Pug templates.
Dataview
5 years ago by Michael Brenan
A data index and query language over Markdown files, for https://obsidian.md/.
Charts View
5 years ago by caronchen
Data visualization solution in Obsidian, support plots and graphs.
Crackboard
2 years ago by Franklin
Obsidian plugin for crackboard.dev
MOC Link Helper
a year ago by Bogdan Codreanu
This obsidian plugins allows you to quickly see which notes you need to include in your MOC.
Dataview Autocompletion
a year ago by Daniel Bauer
Every Day Calendar
a year ago by QuBe
Obsidian plugin to create calendars inspired by Simone Giertz's Every Day Calendar
SQLSeal Charts
a year ago by hypersphere
Charting extension for SQLSeal Obsidian Plugin. Visualise your data!
Tier List
a year ago by Mox Alehin
Obsidian plugin for visual ranking and organizing content into customizable Tier Lists.
CSV All-in-One
a year ago by hihangeol
Tagvis
a year ago by Mason Bryant
Smart ChatGPT
a year ago by 🌴 Brian
Kanban Status Updater
a year ago by Ankit Kapur
Obsidian plugin that automatically updates the note property when card is moved to a column.
DataCards
a year ago by Sophokles187
Obsidian Plugin that transforms dataview tables into visually appealing and customizable card layouts.
Virtual Footer
a year ago by Signynt
Display markdown text (including dataview queries or Obsidian bases) at the bottom or top of all notes which match a specified rule, without modifying them.
Log Keeper
10 months ago by James Sonneveld
Generates times stamps automatically as changes are made to a note.
Slash snippets
10 months ago by echo-saurav
Insert snippet of text with slash command
Dataview (to) Properties
9 months ago by Mara-Li
Sync inline Dataview to properties (YAML frontmatter)
Move Cursor On Startup
8 months ago by Jared Kelnhofer
Obsidian plugin to move the cursor to the right and back to the left when starting up. Why? To keep DataView expressions from not running on the first load of, say, your Home file.
Tasks Map
7 months ago by NicoKNL
A graph view of your tasks.
Tag Timer
4 months ago by quantavil
The Tag Timer is a versatile plugin for Obsidian that allows you to seamlessly track the time you spend on specific tasks or sections within your notes.
Role Switch
2 months ago by Zafrem
Switch between different work roles (developer, writer, researcher, etc.) with intentional transitions and session tracking.
TikToker
2 months ago by ameyxd
Save TikTok videos as markdown notes with embedded content and metadata extraction.