Only the Linux version of the updated package is here , but for Windows users (like say 80% of the USERs) you can just source the 2 R files within the package sub structure after unzipping the downloaded tar.z file TWICE. The package takes care of taking you to the correct link for authentication after the line access_token <- query$authorize(), you need to
1) sign in to your Google account
2) click grant access (blue button)
3) click exchange tokens (blue button)
4) paste the access token at the prompt specified within the R console
access tokens stay active for 3600 seconds !
library(rjson) library(RCurl) source('C:\\Users\\KUs\\Desktop\\RGoogleAnalytics_1.2.tar\\RGoogleAnalytics\\R\\QueryBuilder.R') source('C:\\Users\\KUs\\Desktop\\RGoogleAnalytics_1.2.tar\\RGoogleAnalytics\\R\\RGoogleAnalytics.R') query <- QueryBuilder() access_token <- query$authorize()
ga <- RGoogleAnalytics() ga.profiles <- ga$GetProfileData(access_token) ga.profiles query$Init(start.date = "2012-06-18", end.date = "2012-12-18", dimensions = "ga:date,ga:pagePath", metrics = "ga:visits,ga:pageviews,ga:timeOnPage", sort = "ga:visits", #filters="", #segment="", max.results = 99, table.id = paste("ga:",ga.profiles$id[3],sep="",collapse=","), access_token=access_token) # 4. Make a request to get the data from the API ga.data <- ga$GetReportData(query)# 5. Look at the returned data head(ga.data)
Created by Pretty R at inside-R.org
Interested in using R for Web Analytics? Use it from here http://code.google.com/p/r-google-analytics/
Great work by the Google team (Michael Pearmain et al) and Tatvic team working together!