Alluvial Plot For Readers Journey

Using R + SiteCat API (ex. QueuePathing) + Sketch, came up with an alluvial plot for critical reader's journey with path no deeper than 3. Next step would be to extend this to arbitrary path-length without using Sketch for annotations (using D3 instead).

Code
require("alluvial") || install_github("mbojan/alluvial")  
library(alluvial)

date.from <- "2016-03-18"  
date.to   <- "2016-05-18"

key_metric  <- "pageviews"  
element     <- "prop8"

paths_of_interest <- vector(mode = "list")  
paths_of_interest[[1]] <- c("Article", "::exited::")  
paths_of_interest[[2]] <- c("Article", "Index", "::exited::")  
paths_of_interest[[3]] <- c("Article", "Article", "::exited::")  
paths_of_interest[[4]] <- c("Homepage", "Article", "::exited::")  
paths_of_interest[[5]] <- c("Article", "Homepage", "::exited::")  
paths_of_interest[[6]] <- c("Article", "Video", "::exited::")  
paths_of_interest[[7]] <- c("Article", "PhotoGallery", "::exited::")  
paths_of_interest[[8]] <- c("Homepage", "Video", "::exited::")  
paths_of_interest[[9]] <- c("Homepage", "Index", "::exited::")  
paths_of_interest[[10]] <- c("Homepage", "LiveArticle", "::exited::")  
paths_of_interest[[11]] <- c("Article", "LiveArticle", "::exited::")  
paths_of_interest[[12]] <- c("Article", "Homepage", "Article")  
paths_of_interest[[13]] <- c("Article", "Homepage", "LiveArticle")  
paths_of_interest[[14]] <- c("Article", "Homepage", "Index")  
paths_of_interest[[15]] <- c("Article", "Homepage", "PhotoGallery")  
paths_of_interest[[16]] <- c("Index", "Homepage", "::exited::")  
paths_of_interest[[17]] <- c("Index", "::exited::")  
paths_of_interest[[18]] <- c("Index", "Article", "::exited::")  
paths_of_interest[[19]] <- c("Index", "LiveArticle", "::exited::")  
paths_of_interest[[20]] <- c("Index", "LiveArticle", "Index")  
paths_of_interest[[21]] <- c("Index", "Fantasy Sports", "::exited::")  
paths_of_interest[[22]] <- c("Index", "Fantasy Sports", "Index")  
paths_of_interest[[23]] <- c("Homepage", "Article", "Homepage")  
paths_of_interest[[24]] <- c("Homepage", "Article", "Index")  
paths_of_interest[[25]] <- c("Homepage", "Article", "Video")  
paths_of_interest[[26]] <- c("Homepage", "Article", "LiveArticle")  
paths_of_interest[[27]] <- c("Homepage", "Article", "PhotoGallery")


# Used to accumulate a set of pathing reports
pathing_report_frame <- data.frame()

# Loop through the paths and gather pathing report
for(path_index in 1:length(paths_of_interest)) { 

  pathing_report <- QueuePathing("fairfaxau-mastheads-prd",
                                 date.from, 
                                 date.to,
                                 metric = key_metric,
                                 element = element,
                                 paths_of_interest[[path_index]])

  pathing_report_frame <- rbind.fill(pathing_report_frame, pathing_report)

}

pathing_report_frame_final <- pathing_report_frame[, c("step.1", "step.2", "step.3", "count")]

alluvial(pathing_report_frame_final[,1:3],  
         freq = pathing_report_frame_final.alluvial$count,
         border = NA,
         col = "#499E05")