How to Display Additional Stats Like Reviews and Merged PRs in GitHub Readme Stats

To display reviews, merged PRs, and merged PR percentages in your GitHub Readme Stats card, you must enable the include_merged_pull_requests=true parameter to fetch the data and add reviews, prs_merged, and prs_merged_percentage to the show parameter to render them.

The anuraghazra/github-readme-stats repository generates customizable SVG cards showing GitHub contribution metrics. By default, the GraphQL query fetches standard statistics but excludes merged pull request counts to optimize performance. The rendering layer also hides optional fields unless explicitly requested. Surfacing additional stats like reviews and merged PRs requires coordinating both the data fetcher and the card renderer through specific query parameters.

Enable Merged Pull Request Data Fetching

Before the card can display merged PR counts, you must instruct the fetcher to request this data from GitHub's GraphQL API.

The include_merged_pull_requests Parameter

Set include_merged_pull_requests=true in your request URL. This flag is processed in src/fetchers/stats.js, where the includeMergedPullRequests variable (lines 55-61) conditionally adds the mergedPullRequests field to the GraphQL query.

Without this parameter, the API response excludes merged PR data entirely, making it impossible to display regardless of renderer settings.

![Stats](https://github-readme-stats.vercel.app/api?username=yourusername&include_merged_pull_requests=true)

Configure the Card Renderer to Show Reviews and Merged PRs

Once the data is available, you must explicitly tell the card which optional statistics to visualize using the show parameter.

The show Parameter for Optional Stats

Add the desired keys to the show comma-separated list. The renderStatsCard function in src/cards/stats.js checks options.show using if (show.includes(...)) blocks (lines 49-57) to determine which rows to generate.

Available optional stats include:

  • reviews – Total pull request reviews performed
  • prs_merged – Total merged pull requests
  • prs_merged_percentage – Percentage of merged PRs versus total PRs
![Stats](https://github-readme-stats.vercel.app/api?username=yourusername&include_merged_pull_requests=true&show=reviews,prs_merged,prs_merged_percentage)

Complete Implementation Examples

Combine both parameters to fetch and display the additional metrics.

Markdown URL for README

Use this full URL structure in your README file, replacing YOUR_USERNAME with your GitHub handle:

[![My GitHub Stats](https://github-readme-stats.vercel.app/api?username=YOUR_USERNAME&include_merged_pull_requests=true&show=reviews,prs_merged,prs_merged_percentage&theme=radical&hide=issues,contribs)](https://github.com/yourname/yourrepo)

The hide parameter optionally removes default rows (e.g., issues, contribs) to emphasize the new stats.

Programmatic Usage with Node.js

Fetch the SVG programmatically using query parameters:

import fetch from "node-fetch";

const username = "YOUR_USERNAME";
const url = new URL("https://github-readme-stats.vercel.app/api");

url.searchParams.append("username", username);
url.searchParams.append("include_merged_pull_requests", "true");
url.searchParams.append("show", "reviews,prs_merged,prs_merged_percentage");

const response = await fetch(url);
const svg = await response.text();
console.log(svg);

Direct Library Integration

If embedding the library in your own server, import the fetcher and renderer directly:

import { fetchStats } from "./src/fetchers/stats.js";
import { renderStatsCard } from "./src/cards/stats.js";

const stats = await fetchStats(
  "YOUR_USERNAME",
  false,    // include_all_commits
  [],       // exclude_repo
  true,     // include_merged_pull_requests
  false,    // include_discussions
  false,    // include_discussions_answers
  undefined // commits_year
);

const svg = renderStatsCard(stats, {
  show: ["reviews", "prs_merged", "prs_merged_percentage"],
});

Key Source Files Reference

File Role Relevant Section
src/fetchers/stats.js Builds the GraphQL query and forwards request parameters. includeMergedPullRequests variable (lines 55-61) – adds the mergedPullRequests field when the flag is true.
src/cards/stats.js Generates the SVG card and decides which rows to output. if (show.includes("prs_merged")) blocks (lines 49-57) – creates rows for merged PRs, merged-PR percentage, and reviews based on the show array.
src/translations.js Holds locale strings referenced by the card (e.g., "statcard.reviews").

Summary

  • Enable data fetching by adding include_merged_pull_requests=true to request the merged PR count from GitHub's GraphQL API via src/fetchers/stats.js.
  • Control visibility by adding reviews, prs_merged, and prs_merged_percentage to the show parameter, which src/cards/stats.js uses to conditionally render SVG rows.
  • Combine parameters in a single URL or programmatic call to surface these optional contribution metrics alongside or in place of default statistics.

Frequently Asked Questions

How do I hide default stats while showing merged PRs?

Use the hide parameter to remove default rows such as issues, contribs, or prs while simultaneously using show to add the merged PR metrics. For example: hide=issues,contribs&show=prs_merged,prs_merged_percentage. The renderStatsCard function processes hide before show, allowing you to completely customize the visible statistics.

Can I display the merged PR percentage without the raw count?

Yes. The show parameter accepts individual keys, so you can request only prs_merged_percentage without prs_merged. However, you must still include include_merged_pull_requests=true in the URL so that the fetcher retrieves the underlying data required to calculate the percentage. Omitting the fetcher flag results in zero values for all merged PR-related fields.

Why aren't my merged PRs showing up even with the parameter enabled?

You likely enabled the fetcher flag (include_merged_pull_requests=true) but forgot to add the keys to the show parameter. The fetcher retrieves the data, but src/cards/stats.js hides optional rows by default. Ensure your URL contains both the fetcher flag and show=reviews,prs_merged (or whichever specific metrics you want visible).

Is there a performance impact when enabling merged PR fetching?

Enabling include_merged_pull_requests increases the complexity of the GraphQL query sent to GitHub's API, which may slightly increase response latency compared to the default fetch. However, the impact is generally negligible for individual card generation. If you are generating cards for high-traffic documentation, consider caching the SVG response to minimize repeated API calls with expensive query parameters.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →