Plausible Tracker

Image preview of Plausible Tracker plugin.

plausible-stats.1m.js

Edit
Open on GitHub
#!/usr/bin/env /usr/local/bin/node
// ! Run "which node" in your terminal to determine your path, if any error occurs.
// "/usr/local/bin/node" is just a default.

// Metadata allows your plugin to show up in the app, and website.
//
//  <xbar.title>Plausible Tracker</xbar.title>
//  <xbar.version>v1.0</xbar.version>
//  <xbar.author>Tom Schönmann</xbar.author>
//  <xbar.author.github>flaming-codes</xbar.author.github>
//  <xbar.desc>See who's on your site at-a-glance.</xbar.desc>
//  <xbar.dependencies>node</xbar.dependencies>
//  <xbar.abouturl>https://flaming.codes</xbar.abouturl>
//  <xbar.image>https://cdn.sanity.io/images/udzdriea/production/af38732db5fc82b0d705ec780c77fb4d4c92ce5b-732x212.jpg</xbar.image>
//  <xbar.var>string(ENV_SITE_ID=""): Your site's ID in Plausible.</xbar.var>
//  <xbar.var>string(ENV_API_KEY=""): The generated API-key in Plausible for the site.</xbar.var>
//
// User data.
// ! Update the following values with your data.
//

const SITE_ID = $ENV_SITE_ID;
const API_KEY = $ENV_API_KEY;

// Define custom icons for each step,
// where each value defines the lower
// bound for its activation.
//
// You can define a single string to render,
// or provide custom options accorindg to
// the xbar-API (https://github.com/matryer/xbar-plugins/blob/main/CONTRIBUTING.md).
//
// Pattern:
// 1. [number, string]              Simple icon to render.
// 2. [number, string, string]      Provide a string of options, where each index maps
//                                  a value (2nd param) to an accessor (3rd param).
const stepIcons = [
  [0, `${getPlausibleIconWhite()} Menlo white`, "image font color"],
  [100, "🎆"],
];

// https://plausible.io/docs/stats-api#time-periods
const timeRange = ["day", "7d", "30d", "month", "6mo", "12mo"][0];
const metrics = ["visitors", "pageviews", "bounce_rate", "visit_duration"];

//
// Imports.
//

const https = require("https");

//
// Main (app start).
//

renderApp();

//
// Render calls.
//

async function renderApp() {
  const connection = await getDirtyConnectionAvailability();
  if (connection.state === "offline") {
    renderError({ source: "offline" });
    return;
  }

  const [visitorsNowRes, aggregateRes, breakdownRes] = await Promise.all([
    fetcher({
      path: `/api/v1/stats/realtime/visitors?site_id=${SITE_ID}`,
    }),
    fetcher({
      path: `/api/v1/stats/aggregate?site_id=${SITE_ID}&period=${timeRange}&metrics=${metrics.join(
        ","
      )}`,
    }),
    fetcher({
      path: `/api/v1/stats/breakdown?site_id=${SITE_ID}&period=${timeRange}&property=visit:source&limit=5`,
    }),
  ]);

  const { error, data } = visitorsNowRes;
  if (data >= 0) renderMenuItemData({ data });
  else if (error) renderError({ error });

  renderTimeRangeData();
  if (aggregateRes.data) {
    renderAggregateData({ data: aggregateRes.data.results });
  }
  if (breakdownRes) {
    renderTopSourcesData({ data: breakdownRes.data.results });
  }

  render(getLinksMenu());
}

function renderError(props) {
  const { error, source } = props;

  render(
    [
      "❔",
      "---",
      "No data accessible",
      !source && "Please check your user data",
      source === "offline" && "No internet connection",
      ...getLinksMenu(),
    ].filter(Boolean)
  );
}

function renderTimeRangeData() {
  render(["---", formatTimeRange()]);
}

function renderAggregateData({ data }) {
  render(["---", ...formatAggregateData(parseAggregateData({ data }))]);
}

function renderTopSourcesData({ data }) {
  render([
    "---",
    "Top sources",
    ...data.map((tuple, i) => `${i + 1}. ${tuple.source}`),
  ]);
}

//
// Utilities.
//

function render(items) {
  console.log(items.join("\n"));
}

async function fetcher(params) {
  return new Promise((resolve, reject) => {
    let body = "";
    const request = {
      host: "plausible.io",
      path: params.path,
      method: params.method || "GET",
      headers: {
        Authorization: `Bearer ${API_KEY}`,
      },
    };

    try {
      const req = https.get(request, (res) => {
        res.on("data", (data) => {
          body += data;
        });
        res.on("end", () => {
          resolve(JSON.parse(body));
        });
      });

      req.on("error", (error) => {
        console.error(error);
      });

      req.end();
    } catch (error) {
      reject(error);
    }
  })
    .then((data) => ({ data }))
    .catch((error) => ({ error }));
}

function findCurrentStepIcon(count) {
  const tuple = stepIcons.reverse().find((tuple, i) => count >= tuple[0]);

  // Branch out early
  if (!tuple) return "";
  return [tuple[1], tuple[2]];
}

function composeStatusBarFieldFromIcon([icon, stringifiedFields]) {
  if (!stringifiedFields) {
    return icon;
  }

  const inputs = icon.split(" ");
  const fields = stringifiedFields.split(" ");

  return `| ${inputs.map((input, i) => `${fields[i]}=${input}`).join(" ")}`;
}

function renderMenuItemData(props) {
  const { data } = props;

  render([
    `${data} ${composeStatusBarFieldFromIcon(findCurrentStepIcon(data))}`,
  ]);
}

function parseAggregateData({ data }) {
  return Object.keys(data).map((key) => [key, data[key].value]);
}

function formatAggregateData(tuples) {
  const keyLablesMap = {
    bounce_rate: "Bounce rate",
    pageviews: "Pageviews",
    visit_duration: "Visit duration",
    visitors: "Visitors",
  };

  const valueFormattersMap = {
    bounce_rate: (v) => `${v}%`,
    pageviews: (v) => v,
    visit_duration: (v) => `${v} seconds`,
    visitors: (v) => v,
  };

  return tuples.map(
    ([k, v]) => `${keyLablesMap[k]}: ${valueFormattersMap[k](v)}`
  );
}

function formatTimeRange() {
  const rangeLabelsMap = {
    day: "Today",
    "7d": "Last 7 days",
    "30d": "Last 30 days",
    month: "This month",
    "6mo": "Last 6 months",
    "12mo": "Last 12 months",
  };

  const translated = rangeLabelsMap[timeRange];
  return translated || timeRange;
}

function getLinksMenu() {
  return [
    "---",
    `Open dashboard | href=https://plausible.io/${SITE_ID}?period=realtime | image=${getExternalLinkIconWhite()}`,
    `Made by flaming.codes | href=https://flaming.codes | image=${getExternalLinkIconWhite}`,
  ];
}

async function getDirtyConnectionAvailability() {
  return new Promise((res) =>
    require("dns").lookupService("8.8.8.8", 53, (err) => {
      if (err) res({ state: "offline" });
      else res({ state: "online" });
    })
  );
}

//
// Image sources.
//

function getPlausibleIconDefault() {
  return "iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgA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EMKVS5WdDymQbEwBgt/rcNazcFVxvGsskAJTngJGhaqYnIwwhKcefa25adO5o+NjUVXRGHITggI9x8MBTotfVWV4Z67k5CsWtBo2FCYwI1xzcKyYpDapy3nJhJfHS6kP8hmUzNY5EJ7z3ZgISDb4XXH8XVa866LyxyPEAnPi3vzSXj6yexRFWAWg7vbHd/qvVANOQ6vIBQ4LgIhDBW0uelCdr/2eYixn/YKhiYhBGQ5vGTbHFcYD3bneoPDiCHz4nT8OXKyl00IyHVgzsFU0VlWb3hQMx04+WimaBgGHqt724SAtpruxUrVhZXrNqgy23j+1P7s1NS+3/YWpeVNqKhTUenTaE5fnszF3nmwmH4La8b+L2CGPocKDBX4PxS4Advtw1RbKwz0AAAAAElFTkSuQmCC";
}

function getPlausibleIconWhite() {
  return "iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAJAAAAABAAAAkAAAAAEAAqACAAQAAAABAAAAJKADAAQAAAABAAAAJAAAAACP5Tu0AAAACXBIWXMAABYlAAAWJQFJUiTwAAACymlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgIC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gA4Ijj5tuAG35Vpi5cRgaI9coz+ruZJ/zyNHewQv76sgHpVhDvZzKO/Y7MDPI5Za7xaOpI+QEnSJWl6se1eIE4gQWO4Ff9nC4OJnhSVYAAAAASUVORK5CYII=";
}

function getPlausibleIconBlack() {
  return "iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAJAAAAABAAAAkAAAAAEAAqACAAQAAAABAAAAJKADAAQAAAABAAAAJAAAAACP5Tu0AAAACXBIWXMAABYlAAAWJQFJUiTwAAACymlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj4xNDQ8L3RpZmY6WVJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjE0NDwvdGlmZjpYUmVzb2x1dGlvbj4KICAgICAgICAgPHRp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AAABJRU5ErkJggg==";
}

function getPlausibleBrandingWhite() {
  return "iVBORw0KGgoAAAANSUhEUgAAAFAAAAAQCAYAAACBSfjBAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA7GVYSWZNTQAqAAAACAAHARIAAwAAAAEAAQAAARoABQAAAAEAAABiARsABQAAAAEAAABqASgAAwAAAAEAAgAAATEAAgAAACgAAAByATIAAgAAABQAAACah2kABAAAAAEAAACuAAAAAAAAAEgAAAABAAAASAAAAAFBZG9iZSBQaG90b3Nob3AgRWxlbWVudHMgMTguMCAoV2luZG93cykAMjAyMTowNDozMCAxOTo1ODozNAAAA5AEAAIAAAAUAAAA2KACAAQAAAABAAAAUKADAAQAAAABAAAAEAAAAAAyMDIxOjA0OjMwIDE5OjU4OjM0AC3/DTwAAAAJcEhZcwAACxMAAAsTAQCanBgAAAqbaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA2LjAuMCI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgICAgICAgICB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbn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