MyNixOS website logo
Description

Manage GTmetrix Tests in R.

This is a library to access the current API of the web speed test service 'GTmetrix'. It provides a convenient wrapper to start tests, get reports, and access all kinds of meta data. For more information about using the API please visit <https://gtmetrix.com/api/docs/2.0/>.

rgtmx

R-CMD-check

Context

This is a convenience wrapper for the GTmetrix API 2.0.

I whipped up a small library to talk to GTmetrix via R. There's some basic sanity checking baked in, but obviously this is still work in progress and there are (potentially critical) bugs. Feel free to check it out, though. If you need help, take a look at the manuals. A good point to start is ?start_test.

If you have feedback and/or points for improvement, feel free to open an issue / PR here on Github. I would love to hear from you!

Roman

Usage

# Install and load library.
devtools::install_github("RomanAbashin/rgtmx")
library(rgtmx)

Start test (and get results)

Minimal example #1

# Returns the final report (after checking for completion roughly every 3 seconds). 
result <- start_test("google.com", "[API_KEY]")

This will start a test and wait for the report to be generated, returning the result as data.frame. Optionally, you can just simply return the test ID and other meta data via the parameter wait_for_completion = FALSE.

Minimal example #2

# Returns just the test ID and some meta data. Does not wait for report completion.
result <- start_test("google.com", "[API_KEY]", wait_for_completion = FALSE)

Optional parameters

Other optional parameters are: location, browser, report, retention, httpauth_username, httpauth_password, adblock, cookies, video, stop_onload, throttle, allow_url, block_url, dns, simulate_device, user_agent, browser_width, browser_height, browser_dppx, browser_rotate.

Please consult the manual via ?start_test or the GTmetrix API documentation for further information.

Locations

# Show available locations
show_available_locations("[API_KEY]")
# Get location details
get_location_details(location_id = 1, "[API_KEY]")

Browsers

# Show available browsers
show_available_browsers("[API_KEY]")
# Get browser details
get_browser_details(browser_id = 3, [API_KEY]")

Tests / Reports

# Get specific test
get_test("[TEST_ID]", "[API_KEY]")
# Get specific report
get_report("[REPORT_ID]", "[API_KEY]")
# Get all tests
get_all_tests("[API_KEY]")

Account

# Get account status and available credits
get_account_status("[API_KEY]")
Metadata

Version

0.1.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows