OliverKeyes has submitted this change and it was merged. Change subject: Add external referral traffic (and fix links) ......................................................................
Add external referral traffic (and fix links) Bug: T127868 Change-Id: I61da25f48a6af81005eb0b7f3a7d95cb4ea18f4e --- M functions.R M server.R M tab_documentation/breakdown.md M tab_documentation/browsers.md M tab_documentation/dwelltime.md M tab_documentation/geography.md M tab_documentation/pageviews.md A tab_documentation/referers_byengine.md A tab_documentation/referers_summary.md M ui.R 10 files changed, 129 insertions(+), 10 deletions(-) Approvals: OliverKeyes: Verified; Looks good to me, approved diff --git a/functions.R b/functions.R index a429dc6..7d7e379 100644 --- a/functions.R +++ b/functions.R @@ -53,6 +53,35 @@ pageview_data <<- polloi::read_dataset(path = "portal/portal_pageviews.tsv") } +read_referrals <- function(){ + + # Read in the initial data + data <- as.data.table(polloi::read_dataset(path = "portal/portal_referer_data.tsv")) + + # Format + data$is_search <- ifelse(data$is_search, "Referred by search", "Not referred by search") + data$search_engine[data$search_engine %in% c("none","None")] <- "Not referred by search" + + # Write out the overall values for traffic + interim <- data[, j = list(pageviews = sum(pageviews)), + by = c("date", "is_search")] %>% + reshape2::dcast(formula = date ~ is_search, fun.aggregate = sum) + interim$Total <- interim$`Not referred by search` + interim$`Referred by search` + interim$`Not referred by search` <- round(100*interim$`Not referred by search`/interim$Total, 2) + interim$`Referred by search` <- round(100*interim$`Referred by search`/interim$Total, 2) + summary_traffic_data <<- interim[, 1:3] + + # Generate per-engine values + interim <- data[data$search_engine != "Not referred by search", + j = list(pageviews = sum(pageviews)), + by = c("date", "search_engine")] %>% + reshape2::dcast(formula = date ~ search_engine, fun.aggregate = sum) + bysearch_traffic_data <<- cbind(date = interim$date, data.frame(round(100*t(apply(interim[, -1], 1, function(x) { x/sum(x) })), 2))) + + return(invisible()) + +} + # Fits an exponential model to the data and returns the rate of growth (or decay!) get_exp_rate <- function(dates, y) { time_frame <- range(dates) diff --git a/server.R b/server.R index 59a1ae2..47c32bc 100644 --- a/server.R +++ b/server.R @@ -11,6 +11,7 @@ read_country() read_useragents() read_pageviews() + read_referrals() existing_date <<- Sys.Date() } @@ -138,4 +139,27 @@ dyCSS(css = "www/inverse.css") %>% dyAxis("x", axisLabelFormatter = polloi::custom_axis_formatter, axisLabelWidth = 70) }) + + output$referer_summary_dygraph <- renderDygraph({ + summary_traffic_data %>% + polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_referer_summary)) %>% + polloi::make_dygraph(xlab = "Date", ylab = "% of Pageviews", + title = "Traffic to Wikipedia Portal brown down by origin") %>% + dyCSS(css = "www/inverse.css") %>% + dyAxis("x", axisLabelFormatter = polloi::custom_axis_formatter, axisLabelWidth = 70) %>% + dyAxis("y", valueFormatter = 'function(x) { return x + "%"; }') %>% + dyLegend(labelsDiv = "referer_summary_legend", show = "always", width = 400) + }) + + output$search_engines_dygraph <- renderDygraph({ + bysearch_traffic_data %>% + polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_search_engines)) %>% + polloi::make_dygraph(xlab = "Date", ylab = "% of Pageviews", + title = "Traffic to Wikipedia Portal broken down by search engine") %>% + dyCSS(css = "www/inverse.css") %>% + dyAxis("x", axisLabelFormatter = polloi::custom_axis_formatter, axisLabelWidth = 70) %>% + dyAxis("y", valueFormatter = 'function(x) { return x + "%"; }') %>% + dyLegend(labelsDiv = "search_engines_legend", show = "always", width = 400) + }) + }) diff --git a/tab_documentation/breakdown.md b/tab_documentation/breakdown.md index beb3b10..ad2a190 100644 --- a/tab_documentation/breakdown.md +++ b/tab_documentation/breakdown.md @@ -32,7 +32,7 @@ <hr style="border-color: gray;"> <p style="font-size: small; color: gray;"> <strong>Link to this dashboard:</strong> - <a href="http://discovery.wmflabs.org/portal/#clickthrough_breakdown"> - http://discovery.wmflabs.org/portal/#clickthrough_breakdown + <a href="http://discovery.wmflabs.org/portal/#action_breakdown"> + http://discovery.wmflabs.org/portal/#action_breakdown </a> </p> diff --git a/tab_documentation/browsers.md b/tab_documentation/browsers.md index 14aa0a9..22f50eb 100644 --- a/tab_documentation/browsers.md +++ b/tab_documentation/browsers.md @@ -20,7 +20,7 @@ <hr style="border-color: gray;"> <p style="font-size: small; color: gray;"> <strong>Link to this dashboard:</strong> - <a href="http://discovery.wmflabs.org/portal/#geographic"> - http://discovery.wmflabs.org/portal/#geographic + <a href="http://discovery.wmflabs.org/portal/#browser_breakdown"> + http://discovery.wmflabs.org/portal/#browser_breakdown </a> </p> diff --git a/tab_documentation/dwelltime.md b/tab_documentation/dwelltime.md index b2e12de..acb7659 100644 --- a/tab_documentation/dwelltime.md +++ b/tab_documentation/dwelltime.md @@ -21,7 +21,7 @@ <hr style="border-color: gray;"> <p style="font-size: small; color: gray;"> <strong>Link to this dashboard:</strong> - <a href="http://discovery.wmflabs.org/portal/#dwelltime"> - http://discovery.wmflabs.org/portal/#dwelltime + <a href="http://discovery.wmflabs.org/portal/#dwell_data"> + http://discovery.wmflabs.org/portal/#dwell_data </a> </p> diff --git a/tab_documentation/geography.md b/tab_documentation/geography.md index 2399d40..b094281 100644 --- a/tab_documentation/geography.md +++ b/tab_documentation/geography.md @@ -18,7 +18,7 @@ <hr style="border-color: gray;"> <p style="font-size: small; color: gray;"> <strong>Link to this dashboard:</strong> - <a href="http://discovery.wmflabs.org/portal/#geographic"> - http://discovery.wmflabs.org/portal/#geographic + <a href="http://discovery.wmflabs.org/portal/#country_breakdown"> + http://discovery.wmflabs.org/portal/#country_breakdown </a> </p> diff --git a/tab_documentation/pageviews.md b/tab_documentation/pageviews.md index e1d680c..5158a5e 100644 --- a/tab_documentation/pageviews.md +++ b/tab_documentation/pageviews.md @@ -19,7 +19,7 @@ <hr style="border-color: gray;"> <p style="font-size: small; color: gray;"> <strong>Link to this dashboard:</strong> - <a href="http://discovery.wmflabs.org/portal/#pageviews"> - http://discovery.wmflabs.org/portal/#pageviews + <a href="http://discovery.wmflabs.org/portal/#pageview_tab"> + http://discovery.wmflabs.org/portal/#pageview_tab </a> </p> diff --git a/tab_documentation/referers_byengine.md b/tab_documentation/referers_byengine.md new file mode 100644 index 0000000..6ac79cb --- /dev/null +++ b/tab_documentation/referers_byengine.md @@ -0,0 +1,25 @@ +Traffic to Wikipedia Portal from external search engines, broken down +======= + +This dashboard simply breaks down the [summary data](http://discovery.wmflabs.org/portal/#referrals_summary) to investigate how much of search engine traffic is coming from each engine individually. + +General trends +------ + +On average, Google (the largest engine in our dataset) accounts for 80-81% of the search-engine-referred traffic. Since search-engine-referred traffic accounts for 1.42% of the overall Portal traffic, Google referrals accounts for approximately 1.14% of the overall traffic. + +Outages and inaccuracies +------ +None so far! + +Questions, bug reports, and feature suggestions +------ +For technical, non-bug questions, [email Mikhail](mailto:mpo...@wikimedia.org?subject=Dashboard%20Question). If you experience a bug or notice something wrong or have a suggestion, [open a ticket in Phabricator](https://phabricator.wikimedia.org/maniphest/task/create/?projects=Discovery) in the Discovery board or [email Dan](mailto:dga...@wikimedia.org?subject=Dashboard%20Question). + +<hr style="border-color: gray;"> +<p style="font-size: small; color: gray;"> + <strong>Link to this dashboard:</strong> + <a href="http://discovery.wmflabs.org/portal/#search_engines"> + http://discovery.wmflabs.org/portal/#search_engines + </a> +</p> diff --git a/tab_documentation/referers_summary.md b/tab_documentation/referers_summary.md new file mode 100644 index 0000000..f83d389 --- /dev/null +++ b/tab_documentation/referers_summary.md @@ -0,0 +1,25 @@ +Traffic to Wikipedia Portal from external search engines +======= + +This dashboard simply looks at, very broadly, where our pageviews are coming from. + +General trends +------ + +On average (or "average" because we use medians), traffic from search engines accounts for 1.42% of overall traffic to the Portal. + +Outages and inaccuracies +------ +None so far! + +Questions, bug reports, and feature suggestions +------ +For technical, non-bug questions, [email Mikhail](mailto:mpo...@wikimedia.org?subject=Dashboard%20Question). If you experience a bug or notice something wrong or have a suggestion, [open a ticket in Phabricator](https://phabricator.wikimedia.org/maniphest/task/create/?projects=Discovery) in the Discovery board or [email Dan](mailto:dga...@wikimedia.org?subject=Dashboard%20Question). + +<hr style="border-color: gray;"> +<p style="font-size: small; color: gray;"> + <strong>Link to this dashboard:</strong> + <a href="http://discovery.wmflabs.org/portal/#referrals_summary"> + http://discovery.wmflabs.org/portal/#referrals_summary + </a> +</p> diff --git a/ui.R b/ui.R index 692e0e1..701b375 100644 --- a/ui.R +++ b/ui.R @@ -20,6 +20,10 @@ menuSubItem(text = "Browser breakdown", tabName = "browser_breakdown"), menuSubItem(text = "Pageviews", tabName = "pageview_tab"), icon = icon("line-chart")), + menuItem("External Referrals", + menuSubItem(text = "Overall Referral Traffic", tabName = "referrals_summary"), + menuSubItem(text = "Breakdown by Search Engine", tabName = "search_engines"), + icon = icon("external-link")), menuItem(text = "Global Settings", selectInput(inputId = "smoothing_global", label = "Smoothing", selectize = TRUE, selected = "day", choices = c("No Smoothing" = "day", "Weekly Median" = "week", "Monthly Median" = "month")), @@ -81,6 +85,18 @@ polloi::smooth_select("smoothing_pageviews"), dygraphOutput("pageview_dygraph"), includeMarkdown("./tab_documentation/pageviews.md") + ), + tabItem(tabName = "referrals_summary", + fluidRow(column(polloi::smooth_select("smoothing_referer_summary"), width = 3), + column(div(id= "referer_summary_legend"), width = 8)), + dygraphOutput("referer_summary_dygraph"), + includeMarkdown("./tab_documentation/referers_summary.md") + ), + tabItem(tabName = "search_engines", + fluidRow(column(polloi::smooth_select("smoothing_search_engines"), width = 3), + column(div(id= "search_engines_legend"), width = 8)), + dygraphOutput("search_engines_dygraph"), + includeMarkdown("./tab_documentation/referers_byengine.md") ) ) ) -- To view, visit https://gerrit.wikimedia.org/r/273509 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I61da25f48a6af81005eb0b7f3a7d95cb4ea18f4e Gerrit-PatchSet: 3 Gerrit-Project: wikimedia/discovery/prince Gerrit-Branch: master Gerrit-Owner: Bearloga <mpo...@wikimedia.org> Gerrit-Reviewer: OliverKeyes <oke...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits