Skip to content

Repository files navigation

KPI tracker for OSS maintainers

Google Apps Scripts to track weekly KPIs for open-source projects, stored in a Google Spreadsheet.

Each script appends a dated row on every run, building a time series you can chart and query over time.

Stay up to date: This code runs inside your own Apps Script project β€” updates are not applied automatically. Subscribe to release notifications on GitHub (Watch β†’ Custom β†’ Releases) to be notified when a new version is available, then copy the updated files into your project manually.

image

πŸ“Š Collected KPIs

Category Metrics Cadence
GitHub repo Stars, forks, watchers, open issues, page views & clones (all-time + last 7 days, count + uniques) Weekly
GitHub profile Followers, following, public repos, public gists Weekly
GitHub stargazers Full directory: login, name, email, company, location, bio, Twitter, blog, followers, public repos, starred_at Weekly (incremental)
GitHub search Mentions across code, repos, issues, PRs (open/closed), discussions, users, commits, topics Weekly
GitHub dependents Repositories that depend on your projects (name, stars, forks) Weekly
Google Analytics Active users (7-day, 28-day), new users, sessions, bounce rate, avg session duration, page views Weekly
Pixel tracking Cumulative view count per README badge tracker Daily

πŸ“‹ Scripts

File Entry point Target sheet Notes
github-repositories.gs mainGithubRepositories Github repositories
github-followers.gs mainGithubFollowers Github Followers
github-stargazers.gs mainGithubStargazers Github stargazers Incremental; also run mainPeriodicGithubStargazersSyncOldestRows to refresh stale profiles
github-search.gs mainGithubSearch Github search stats
github-dependents.gs mainGithubDependents Github dependents Scrapes HTML; 20-min guard (free accounts limited to 6 min)
google-analytics.gs mainGA GA stats
pixel-tracking.gs mainGithubPixelTracking Pixel tracking Reads visitor-badge.laobi.icu

Note: The code counter in github-search.gs is unreliable β€” GitHub is migrating its search engine and the API returns inconsistent values. See github/rest-api-description#2956.

βš™οΈ Setup

1. Google Spreadsheet

Create a Google Spreadsheet using this template and list your OSS projects in the following sheets:

Sheet name Purpose
List GitHub repositories Repository list (columns A = owner, B = repo)
List GA GA4 property list (columns A = website, B = property ID)
List pixel trackers Pixel tracker list (columns A = name, B = tracker ID)

Then copy the code into Apps Script and create weekly triggers. The following "Bronze" sheets will fill up:

Sheet name Purpose
Github repositories Output β€” repository stats
Github Followers Output β€” profile follower stats
Github stargazers Output β€” stargazer directory
Github search stats Output β€” search result counts
Github dependents Output β€” dependent repositories
GA stats Output β€” GA4 metrics
Pixel tracking Output β€” pixel view counts

2. Apps Script project

  1. Open Extensions β†’ Apps Script in your spreadsheet.
  2. Copy all .gs files into the project (one file per script, or paste into a single file).
  3. In github-utils.gs, replace the placeholder token(s) in GITHUB_TOKENS with your GitHub personal access tokens.
  4. Set GITHUB_PROFILE in github-utils.gs to your GitHub username.

3. GitHub token scopes

Traffic endpoints (/traffic/views, /traffic/clones) require push access on each repository. For a classic PAT: enable the repo scope. For a fine-grained PAT: grant Administration: Read on each target repository, plus Read-only access to account metadata for the profile endpoint.

4. Google Analytics

Enable the Google Analytics Data API in the Apps Script project (Services β†’ Google Analytics Data API). Then enable the manifest via Project Settings β†’ Show "appsscript.json" manifest file and add the required OAuth scopes:

{
  "timeZone": "America/New_York",
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/analytics.readonly",
    "https://www.googleapis.com/auth/script.external_request"
  ],
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}

5. Triggers

Set up time-based triggers in Triggers (clock icon) for each entry point. Most scripts run weekly; pixel tracking runs daily.

Function Suggested frequency
mainGithubRepositories Weekly
mainGithubFollowers Weekly
mainGithubStargazers Weekly
mainPeriodicGithubStargazersSyncOldestRows Weekly x3
mainGithubSearch Weekly
mainGithubDependents Weekly
mainGA Weekly
mainGithubPixelTracking Daily

🀝 Contributing

Don't hesitate ;)

πŸ‘€ Contributors

Contributors

πŸ’« Show your support

Give a ⭐️ if this project helped you!

GitHub Sponsors

πŸ“ License

Copyright Β© 2026 Samuel Berthe.

This project is under MIT license.

About

πŸ“Š Track your open-source project health: GitHub stats, stargazers, dependents, and Google Analytics. Auto-synced into Google Sheets.

Resources

Code of conduct

Security policy

Stars

10 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages