install.packages("devtools")
devtools::install_github("jlewis91/RGoogleAnalytics", ref = "patch-1")
devtools::install_github("RazorfishGermany/reportingManager")
library(reportingManager)
createConfigTemplate() # Generate `config.json` file template.
## Edit this file with the correct parameters.
## Google Drive
auth_gdrive(<ConfigPath>) # Create google drive credential (will be saved to token/gdrive_token)
## Facebook
auth_fbInsights(config_path, extended_permissions = FALSE)
## Google Analytics
### token will be generated while running "query_ga" with current the config path
## Adobe Analytics
### token will be generated while running "query_sc" with the current config path
queries <- get_gdrive_queries(<ConfigPath>) # Get google drive queries (from folder specified in config)
## Facebook
### Page Engagement
pages <- query_facebook_pages(<PageID>, <StartDate>, <EndDate>) # Dates as character "%Y-%m-%d"
### Post Engagement (need to run query_facebook_pages() before!)
#### Owned Page
posts <- query_facebook_posts() # add metrics parameter for additional metrics on post level (default = "post_impressions_unique")
#### Competitor
competitor_posts <- query_facebook_competitor_posts()
### Insights
insights <- query_facebook(<Queries>, start_date = <StartDate>, end_date = <EndDate>, override_dates = TRUE, include_query_data = TRUE)
## Google
ga_data <- query_ga(<Queries>, <StartDate>, <EndDate>, <ConfigPath>, override_dates = TRUE)
## Adobe
### Trended Reports
trended <- query_sc(<Queries>, <StartDate>, <EndDate>, override_dates = FALSE, config_path = <ConfigPath>)
### Overtime Reports
overtime <- query_sc(<Queries>, <StartDate>, <EndDate>, override_dates = FALSE, config_path = <ConfigPath>)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.