Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Monitor Blog Statistics with StatCounter & R

DZone's Guide to

Monitor Blog Statistics with StatCounter & R

· Big Data Zone
Free Resource

Learn how you can maximize big data in the cloud with Apache Hadoop. Download this eBook now. Brought to you in partnership with Hortonworks.

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

 

Hortonworks DataFlow is an integrated platform that makes data ingestion fast, easy, and secure. Download the white paper now.  Brought to you in partnership with Hortonworks

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}