Big Data/Analytics Zone is brought to you in partnership with:

Kay Cichini (MSc, Biology), Nature Protection Expert, Tyrol/Austria. I'm author of theBioBucket-Blog, where I share examples for data management, data processing, statistical analysis and report generation using the R-Software. Kay is a DZone MVB and is not an employee of DZone and has posted 28 posts at DZone. You can read more from them at their website. View Full User Profile

Monitor Blog Statistics with StatCounter & R

09.11.2012
| 3150 views |
  • submit to reddit

If you're interested in analysing your blog's statistics, you can do it easily with a web-service like StatCounter -- a free (registration-required) service with quite extensive service -- and with R. After implementing the StatCounter script in the HTML code of a webpage or blog, you can download and inspect log-files with some short lines of code in R (see below) and then inspect visitor activity.

url <- "http://statcounter.com/p7447608/csv/download_log_file?form_user=MYUSERNAME&form_pass=MYPASSWORD"
file <- paste(tempdir(), "\\log", ".CSV", sep = "")
download.file(url, dest = file)
log <- read.csv(file, as.is = T, header = T)
 
str(log)
 
'data.frame':   500 obs. of  19 variables:
 $ Date.and.Time   : chr  "2011-12-19 23:32:30" "2011-12-19 23:20:04" "2011-12-19 23:16:24" "2011-12-19 23:14:40" ...
 $ IP.Address      : chr  "93.129.245.130" "128.227.27.189" "207.63.124.250" "140.247.40.121" ...
 $ IP.Address.Label: logi  NA NA NA NA NA NA ...
 $ Browser         : chr  "Chrome" "Firefox" "Chrome" "Firefox" ...
 $ Version         : chr  "16.0" "8.0" "15.0" "6.0" ...
 $ OS              : chr  "MacOSX" "WinXP" "Win7" "MacOSX" ...
 $ Resolution      : chr  "1280x800" "1680x1050" "1280x1024" "1280x800" ...
 $ Country         : Factor w/ 44 levels "Argentina","Australia",..: 17 44 44 44 44 44 44 44 44 44 ...
 $ Region          : chr  "Nordrhein-Westfalen" "Florida" "Illinois" "Massachusetts" ...
 $ City            : chr  "Köln" "Gainesville" "Chicago" "Cambridge" ...
 $ Postal.Code     : int  NA 32611 NA 2138 2138 NA 10003 2138 2138 2138 ...
 $ ISP             : chr  "Telefonica Deutschland GmBH" "UNIVERSITY OF FLORIDA" "Illinois Century Network" "Harvard University" ...
 $ Returning.Count : int  2 0 4 2 2 0 0 2 2 2 ...
 $ Page.URL        : chr  "http://thebiobucket.blogspot.com/2011/11/r-function-google-scholar-webscraper.html" "http://thebiobucket.blogspot.com/2011/04/if-then-vba-script-usage-in-arcgis.html" "http://thebiobucket.blogspot.com/2011/10/how-to-link-to-google-docs-for-download.html" "http://thebiobucket.blogspot.com/2011/08/two-way-permanova-adonis-with-custom.html" ...
 $ Page.Title      : Factor w/ 53 levels "","theBioBucket*",..: 36 50 23 46 10 20 13 9 10 46 ...
 $ Came.From       : chr  "http://stackoverflow.com/questions/5005989/how-to-download-search-results-on-google-scholar-using-r" "http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CCwQFjAC&url=http%3A%2F%2Fthebiobucket.blogspot.com%2F2011%"| __truncated__ "" "" ...
 $ SE.Name         : chr  "" "" "" "" ...
 $ SE.Host         : chr  "" "" "" "" ...
 $ SE.Term         : chr  "" "" "" "" ...

 

Published at DZone with permission of Kay Cichini, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)