Blog Statistics with StatCounter & R
[This article was first published on theBioBucket*, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
If you’re interested in analysing your blog’s statistics this can easily be done with a web-service like StatCounter (free, only registration needed, quite extensive service) and with R.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
After implementing the StatCounter script in the html code of a webpage or blog one can download and inspect log-files with R with some short lines of code (like 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 "" "" "" "" ...
To leave a comment for the author, please follow the link and comment on their blog: theBioBucket*.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.