Skip to contents

Build the query

Usage

build_query(
  date_from,
  date_to,
  website_id,
  columns,
  filters = NULL,
  metric_filters = NULL,
  offset = 0,
  max_lines = 0
)

Arguments

date_from

Start date of query

date_to

End date of query

website_id

website_id from piwik

columns

tibble containing columns and transformations (metrics and dimensions)

filters

list containing filter, best built by build_filter

metric_filters

list containing filter, best built by build_filter

offset

offset

max_lines

limit

Value

query as list

Examples

columns <- tibble::tribble(
  ~column, ~transformation,
  "event_url", "to_path",
  "event_url", "to_domain",
  "website_name", "",
  "timestamp", "",
  "timestamp", "to_hour_of_day",
  "page_views", ""
  )
  build_query(lubridate::ymd("2021-01-01"), lubridate::ymd("2021-01-19"),
              "xxx", columns)
#> $date_from
#> [1] "2021-01-01"
#> 
#> $date_to
#> [1] "2021-01-19"
#> 
#> $website_id
#> [1] "xxx"
#> 
#> $offset
#> [1] 0
#> 
#> $limit
#> [1] 1e+05
#> 
#> $columns
#> $columns[[1]]
#> $columns[[1]]$column_id
#> [1] "event_url"
#> 
#> $columns[[1]]$transformation_id
#> [1] "to_path"
#> 
#> 
#> $columns[[2]]
#> $columns[[2]]$column_id
#> [1] "event_url"
#> 
#> $columns[[2]]$transformation_id
#> [1] "to_domain"
#> 
#> 
#> $columns[[3]]
#> $columns[[3]]$column_id
#> [1] "website_name"
#> 
#> 
#> $columns[[4]]
#> $columns[[4]]$column_id
#> [1] "timestamp"
#> 
#> 
#> $columns[[5]]
#> $columns[[5]]$column_id
#> [1] "timestamp"
#> 
#> $columns[[5]]$transformation_id
#> [1] "to_hour_of_day"
#> 
#> 
#> $columns[[6]]
#> $columns[[6]]$column_id
#> [1] "page_views"
#> 
#> 
#> 
#> $filters
#> NULL
#> 
#> $metric_filters
#> NULL
#> 
#> $max_lines
#> [1] 0
#>