-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathget_usage.Rd
More file actions
67 lines (59 loc) · 2.31 KB
/
Copy pathget_usage.Rd
File metadata and controls
67 lines (59 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get.R
\name{get_usage}
\alias{get_usage}
\title{Get usage information for deployed content}
\usage{
get_usage(client, from = NULL, to = NULL)
}
\arguments{
\item{client}{A \code{Connect} R6 client object.}
\item{from}{Optional \code{Date} or date-time (\code{POSIXct} or \code{POSIXlt}). Only
records after this time are returned. If a \code{Date}, treated as the start of
that day in the local time zone; if a date-time, used verbatim.}
\item{to}{Optional \code{Date} or date-time (\code{POSIXct} or \code{POSIXlt}). Only records
before this time are returned. If a \code{Date}, treated as end of that day
(\code{23:59:59}) in the local time zone; if a date-time, used verbatim.}
}
\value{
A tibble with columns:
\itemize{
\item \code{id}: An identifier for the record.
\item \code{user_guid}: The GUID of logged-in visitors, NA for anonymous.
\item \code{content_guid}: The GUID of the content.
\item \code{timestamp}: The time of the hit as \code{POSIXct}.
\item \code{path}: The path of the hit. Not recorded for all content types.
\item \code{user_agent}: If available, the user agent string for the hit. Not
available for all records.
}
}
\description{
Retrieve content hits for all available content on the server. Available
content depends on the user whose API key is in use. Administrator accounts
will receive data for all content on the server. Publishers will receive data
for all content they own or collaborate on.
If no date-times are provided, all usage data will be returned.
}
\details{
The data returned by \code{get_usage()} includes all content types. For Shiny
content, the \code{timestamp} indicates the \emph{start} of the Shiny session.
Additional fields for Shiny and non-Shiny are available respectively from
\code{get_usage_shiny()} and \code{get_usage_static()}.
When possible, however, we recommend using \code{get_usage()} over
\code{get_usage_static()} or \code{get_usage_shiny()}, as it will be much faster for
large datasets.
}
\examples{
\dontrun{
client <- connect()
# Fetch the last 2 days of hits
usage <- get_usage(client, from = Sys.Date() - 2, to = Sys.Date())
# Fetch usage after a specified date
usage <- get_usage(
client,
from = as.POSIXct("2025-05-02 12:40:00", tz = "UTC")
)
# Fetch all usage
usage <- get_usage(client)
}
}