OliverKeyes has uploaded a new change for review. https://gerrit.wikimedia.org/r/263716
Change subject: Add the dygraphs for geo data on the portal ...................................................................... Add the dygraphs for geo data on the portal Note that it has a known bug; we're using brewer.pal and that has a maximum set of 8. We probably want to check that in the future. Bug: T123347 Change-Id: Icc980272ab2b7db425630f99f10ce6c489016f9d --- M functions.R M server.R A tab_documentation/geography.md M ui.R 4 files changed, 46 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/prince refs/changes/16/263716/1 diff --git a/functions.R b/functions.R index aaa05b5..2baed03 100644 --- a/functions.R +++ b/functions.R @@ -21,3 +21,8 @@ read_dwelltime <- function(){ dwelltime_data <<- as.data.table(polloi::read_dataset(path = "portal/dwell_metrics.tsv")) } + +read_country <- function(){ + country_data <<- reshape2::dcast(polloi::read_dataset(path = "portal/country_data.tsv"), + formula = date ~ country, fun.aggregate = sum) +} diff --git a/server.R b/server.R index 84a84b3..6d1fbab 100644 --- a/server.R +++ b/server.R @@ -5,9 +5,10 @@ shinyServer(function(input, output){ - if (Sys.Date() != existing_date) { + if(Sys.Date() != existing_date) { read_clickthrough() read_dwelltime() + read_country() existing_date <<- Sys.Date() } @@ -37,4 +38,13 @@ tooltip = "Sampling change - see below", width = 12, height = 20, attachAtBottom = FALSE) }) + + output$country_breakdown_dygraph <- renderDygraph({ + polloi::make_dygraph( + data = country_data, + xlab = "Date", + ylab = "Users (%)", + title = "Geographic breakdown of portal visitors" + ) + }) }) diff --git a/tab_documentation/geography.md b/tab_documentation/geography.md new file mode 100644 index 0000000..f6515fe --- /dev/null +++ b/tab_documentation/geography.md @@ -0,0 +1,24 @@ +Dwell-time on the Wikipedia portal +======= + +This measures where portal users come from each day, displaying the proportion of users from each top-10 country and the proportion from other countries, as a percentage. + +General trends +------ + +Outages and inaccuracies +------ + +Broadly-speaking, it's worth noting that (as with all data based on JavaScript logging) the code that gathers this information requires a certain amount of browser capabilities to function. It's probably not going to work on 10 year old Nokia brick phones, and so the data will be biased against users using those kinds of devices. + +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/#geographic"> + http://discovery.wmflabs.org/portal/#geographic + </a> +</p> diff --git a/ui.R b/ui.R index 78f95d1..d426891 100644 --- a/ui.R +++ b/ui.R @@ -15,7 +15,8 @@ sidebarMenu(menuItem(text = "Traffic"), menuSubItem(text = "Clickthrough rate", tabName = "clickthrough_rate"), menuSubItem(text = "Breakdown", tabName = "action_breakdown"), - menuSubItem(text = "Dwell time", tabName = "dwell_data") + menuSubItem(text = "Dwell time", tabName = "dwell_data"), + menuSubItem(text = "Geographic breakdown", tabName = "country_breakdown") ) ) @@ -32,6 +33,10 @@ tabItem(tabName = "dwell_data", dygraphOutput("dwelltime_dygraph"), includeMarkdown("./tab_documentation/dwelltime.md") + ), + tabItem(tabName = "country_breakdown", + dygraphOutput("country_breakdown_dygraph"), + includeMarkdown("./tab_documentation/geography.md") ) ) ) -- To view, visit https://gerrit.wikimedia.org/r/263716 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icc980272ab2b7db425630f99f10ce6c489016f9d Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/discovery/prince Gerrit-Branch: master Gerrit-Owner: OliverKeyes <oke...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits