8-bit-sheep / googleAnalyticsR

Use the Google Analytics API from R
https://8-bit-sheep.com/googleAnalyticsR/
Other
259 stars 76 forks source link

PowerBi and googleAnalyticsR with service account #308

Closed vladimirkuchinsky closed 4 years ago

vladimirkuchinsky commented 4 years ago

Hi! I use the google Analytics R package and my script runs in R Studio without mistakes. I log in using a service account. Here is my script.

library(googleAnalyticsR) googleAuthR::gar_auth_service(json_file = "C:/ga/service-account.json")

my_data <- google_analytics(123456789, date_range = c("2020-04-01", "yesterday"), metrics = c("adClicks","adCost"), dimensions = c("date","sourceMedium","campaign","keyword"), anti_sample = TRUE)

When I try to run it in power Bi I get an error. Here's the error.

Details: "ADO.NET: R script error. 2020-04-15 21:26:03> Default Google Project for googleAnalyticsR is set. This is shared with all googleAnalyticsR users. If making a lot of API calls, please: visit: https://bit.ly/2Evk6hn for instructions on setting your own Google Project Mistake: The default Google Cloud Project for googleAnalyticsR is intended for evalutation only, not production scripts. Please set your own client.id and client.secret via googleAuthR::gar_set_client() or otherwise as suggested on the website.

I can't use database in this project. I would like use the script in powerBi without database. Could you help me? What do I need to add to the script to make it work?

MarkEdmondson1234 commented 4 years ago

Please review the website for setting your own client.id - "Professional mode" https://code.markedmondson.me/googleAnalyticsR/articles/setup.html#professional-mode-your-own-google-project