Over a million developers have joined DZone.
Platinum Partner

Monitor Blog Statistics with StatCounter & R

· Big Data Zone

The Big Data Zone is presented by Exaptive.  Learn how rapid data application development can address the data science shortage.

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  "" "" "" "" ...

 

The Big Data Zone is presented by Exaptive.  Learn about how to rapidly iterate data applications, while reusing existing code and leveraging open source technologies.

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}