Fix documentation and add note about data range representation cludge

Change-Id: I1d4e9926e167963caedc547205a2c0cecf604ae8
3 files changed
tree: db04c5f6111d9322cbe0d92f1eaa5c5624fa412e
  1. man/
  2. R/
  3. .gitignore
  4. .Rbuildignore
  5. DESCRIPTION
  6. LICENSE
  7. LICENSE.md
  8. matomor.Rproj
  9. NAMESPACE
  10. Readme.md
Readme.md

R client library to access the Matomo web service API


Description

The package provides client access to the web service API of the web analytics platform Matomo.

Installation

library(devtools)
install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/matomor") 

Documentation

See matomo Reporting API Reference for details.

NOTE: Currently, the date column in the data frame results refers to the first day of the respective period.

Usage

getVisitsSummary(
  matomoUrl,
  siteId,
  period = "month",
  date = "last16",
  filter_limit = 100,
  removeFirst = FALSE,
  removeLast = FALSE,
  accessToken = getAccessToken(matomoUrl)
)

Arguments

ArgumentDescription
matomoUrlbase URL of your matomo instance
siteIdmatomo site id or vector of site ids
periodday, week, month or year
datedate range (see matomo API reference)
filter_limitdefines the maximum number of rows to be returned
removeFirstlogical that determines whether the first row of each site should be removed (to account for incomplete periods)
removeLastlogical that determines whether the last row of each site should be removed (to account for incomplete periods)
accessTokenAPI Authentication Token - you can get this in your matomo interface under Settings -> Personal -> Settings -> API Authentication Token and pass it here, or you can make it persistent with persistAccessToken.

Examples

ggplot

library(matomor)
library(tidyverse)

# persistAccessToken("https://stats.xxx.org/", "ad7609a669179c4ebca7c995342f7e09")

getVisitsSummary("https://stats.xxx.org/", siteId = c(13,14), period="day", date="last60") %>%
  mutate(service = case_when(site_id == 13 ~ "A", site_id == 14 ~ "B")) %>%
  ggplot(aes(date, nb_actions, color=service)) + 
  scale_color_discrete() + 
  geom_smooth(span=.25, se=FALSE)

highcharter

library(matomor)
library(tidyverse)
library(highcharter)
library(idsThemeR)

# persistAccessToken("https://stats.xxx.org/", "ad7609a669179c4ebca7c995342f7e09")

getVisitsSummary("https://stats.xxx.org/", siteId = c(13,14), period="month", date="last16") %>%
  mutate(service = case_when(site_id == 13 ~ "A", site_id == 14 ~ "B")) %>%
  hchart("spline", hcaes(date, nb_actions, group=service)) %>%
  hc_add_theme(hc_theme_ids_light())

Development and License

Authors: Marc Kupietz

Copyright (c) 2020, Leibniz Institute for the German Language, Mannheim, Germany

This package is developed as part of the KorAP Corpus Analysis Platform at the Leibniz Institute for German Language (IDS).

It is published under the BSD-2 License.

Contributions

Contributions are very welcome!

Your contributions should ideally be committed via our Gerrit server to facilitate reviewing (see Gerrit Code Review - A Quick Introduction if you are not familiar with Gerrit). However, we are also happy to accept comments and pull requests via GitHub.

Please note that unless you explicitly state otherwise any contribution intentionally submitted for inclusion into this software shall – as this software itself – be under the BSD-2 License.