Draws who visits the repositories of a GitHub user and where they come from, from
what collect_stats() collects: their unique visitors and cloners, the sites that sent them
and the pages they viewed, in the last 14 days, as a card for a GitHub profile, a PNG or an SVG
file, in a dark or a light mode.
Usage
plot_visitors_card(
stats = "rghcard-data",
file = "rghcard-visitors.png",
theme = c("dark", "light"),
panels = NULL,
title = NULL,
width = 900
)Arguments
- stats
The statistics: what
collect_stats()orread_stats()return, or the folder of the history.- file
The card: a
.pngor an.svgfile.NULLreturns the SVG code instead.- theme
"dark"or"light": the colors of GitHub's dark or light mode.- panels
One to three charts:
"visitors","referrers"and"top_pages", or those of the other cards. By default all three, in that order.- title
The title, by default the user name.
- width
Width of the card in pixels. A PNG has twice as many, to stay sharp on high-resolution screens.
Details
GitHub gives the sites that send visitors to a repository, and its most viewed pages, only for its last 14 days as a whole, so this card covers those 14 days. The key figures are the unique visitors and cloners, the page views, the sites that sent visitors and the repositories that had any. GitHub counts the visitors of each repository on its own: someone who visits two repositories counts twice. By default the charts are:
"visitors": the unique visitors of each day, as columns."referrers": the five sites that sent the most page views, such as search engines, GitHub itself and the sites that link to the repositories."top_pages": the five most viewed pages of the repositories, each named by its path, without the user name.
Like the page views of plot_stats_card(), the visitors need a token of the user: without one
the card has no numbers. The names of the visitors are never collected: GitHub does not give
them.
See also
view_card() shows the card in the Viewer or the Plots pane, plot_stats_card()
draws the page views and clones themselves, and use_rghcard_action() refreshes the cards on
your profile.
Examples
card <- plot_visitors_card(get_example_stats(), tempfile(fileext = ".svg"))
view_card(card, "plots")
plot_visitors_card(get_example_stats(), tempfile(fileext = ".png"), theme = "light")