get_realtime: Get the Anaytics data from Real Time Reporting API for a view...

Description Usage Arguments Value References See Also Examples

Description

Get the Anaytics data from Real Time Reporting API for a view (profile)

Usage

1
2
get_realtime(profile.id, metrics = "rt:activeUsers", dimensions = NULL,
  sort = NULL, filters = NULL, max.results = NULL, token)

Arguments

profile.id

integer or character. Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. Can be obtained using the list_profiles or via the web interface Google Analytics.

metrics

character. A comma-separated list of real time metrics. E.g., "rt:activeUsers". At least one metric must be specified.

dimensions

character. A comma-separated list of real time dimensions. E.g., "rt:medium,rt:city".

sort

character. A comma-separated list of dimensions or metrics that determine the sort order for real time data.

filters

character. A comma-separated list of dimension or metric filters to be applied to real time data.

max.results

integer. The maximum number of entries to include in this feed.

token

Token2.0 class object with a valid authorization data.

Value

A data frame including the real time data for a view (profile). Addition information about profile and request query stored in the attributes.

References

Real Time Reporting API - Dimensions & Metrics Reference

See Also

authorize

Other Reporting API: firstdate; get_ga; get_mcf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# get token data
authorize()
# get report data
ga_data <- get_realtime("profile_id", metrics = "rt:activeUsers",
                        dimensions = "rt:source,rt:medium")
# get active users in realtime (press Esc to abort)
while (TRUE) {
    cat("\014")
    print(get_realtime("profile_id", metrics = "rt:activeUsers"))
    Sys.sleep(2)
}

## End(Not run)

jdeboer/RGA-1 documentation built on May 18, 2019, 11:29 p.m.