Talk:Wikipedia and Wikidata Tools

Active discussions

On-wiki place for discussionEdit

I wanted to set up an on-wiki place for discussing this tool. Blue Rasberry (talk) 15:15, 9 May 2016 (UTC)

Monthly traffic reports?Edit

At en:Wikipedia:WikiProject Medicine I and other users always are wanting traffic reports, usually for sets of articles in a range of months.

This tool reports daily traffic and generates a lot of numbers. I am having trouble manipulating the output of the tool into something easier to read.

I would like to be able to enter a set of for example 15 Wikipedia articles, or maybe a single category containing about that many articles, and in return get traffic reports saying how many people accessed those articles in a given month. I am still playing with the tool. Right now my problem is that the tool generates 30 points of data (one for each day) if I want traffic for a month, and although the spreadsheet can easily sum the numbers, I do not know how to automate the sums and presentation of the data as a monthly report. This probably is not a problem with the tool - it is a problem manipulating the data. If anyone wants to look at this with me for this problem or any other then please message me. Blue Rasberry (talk) 15:44, 9 May 2016 (UTC)

Yes agree am looking for the same as Lane.
By the way I assume this contains mobile?
Doc James (talk · contribs · email) 02:27, 10 May 2016 (UTC)
I have created a sample spreadsheet that showcases this use case. Feel free to get in touch via email in case of questions. The output of PAGEVIEWS includes human mobile and desktop traffic, yes. Tomayac (talk) 08:41, 10 May 2016 (UTC)

Can one pull a specific month or is this just the last 30 / 31 days? Doc James (talk · contribs · email) 15:29, 10 May 2016 (UTC)

You can pull any range (where the underlying API has data for), the default is to use the last 30 days, but you can just type =WIKIPAGEVIEWS("en:Wikipedia", TODAY() - m, TODAY() - n). Tomayac (talk) 16:28, 11 May 2016 (UTC)
I am having difficulty thinking about this. I need to talk this through to understand what is going on here, so I will even describe the obvious parts of this. In the sample spreadsheet, the output is said to be the sum of the traffic for each of the past 30 days for all of the English Wikipedia articles which are in en:Category:RTT, which is a hidden category set up by the Translation Task Force. There are about 300 articles in that category. Here is what I see -
In column A row 1, anyone can put any English Wikipedia category and the table will generate a report. Lower in column A is an alphabetical list of all the Wikipedia articles in that category. In column B there is a graph in the spreadsheet cell (!) of the rise and fall of article traffic on different days of the month for each article in column A, and to the right of that is the sum of traffic for the past 30 days for that article. Looking to the bottom (not shown in this image), these 300 articles have collectively got about 20,141,828 visitors in the last 30 days, but this number should change every day because the report is for the last 30 days and not a stable report for any given month. Every number in column C should change every day, because it always reports the past 30 days.
@Doc James:, what would you want to see from a tool like this? When I report traffic, I do it by a month that can easily be described, like "March 2016" rather than something arbitrary like "April 13- May 12 2016". I presume you also want to report particular months.
Tomayac suggests that this code can be manipulated to output particular months -
    opt_start = opt_start || new Date( - 30 * 24 * 60 * 60 * 1000);
    if (typeof opt_start === 'object') {
      opt_start = getIsoDate(opt_start);
    opt_end = opt_end || new Date( - 1 * 24 * 60 * 60 * 1000);
    if (typeof opt_end === 'object') {
      opt_end = getIsoDate(opt_end);
This is a bit heavy for me - I am not sure how to translate this in Google Sheets to a request for a particular month. I think for me, I would want to create another two input cells where I could put a start date and end date, then generate a report for days including and between those dates. Usually I would enter something like "March 1 2016" and "March 31 2016". James, what kind of use would be typical for you? Blue Rasberry (talk) 20:57, 12 May 2016 (UTC)
Yes the same Doc James (talk · contribs · email) 21:12, 1 June 2016 (UTC)
Return to "Wikipedia and Wikidata Tools" page.