Template talk:Graph:PageViews

Works with subpages
Thanks for the template, it is helping enWS to investigate the readership. At the Wikisources, works are usually/often set as root page with (numerous) subpages. Is there a means to reflect in the use of the template, or a derivation, to capture views for a work and its subpages? The playing by some was said to indicate that just the root page is being counted in this model. This would be helpful to monitor whether users are reading the whole work, looking at specific components, etc. Thanks. — billinghurst  sDrewth  05:32, 22 February 2016 (UTC)
 * pageviews api only gives data about a single page, so the only option really is to insert multiple graphs, one for each subpage. I could design a graph with multiple lines, but you will still need to provide each subpage title individually, and with many subpages it might get crowded. CC: --Yurik (talk) 13:51, 9 March 2016 (UTC)
 * The Wikisources work differently than the Wikipedias, the WSes have collections of pages (root/subpages); multiple subpages while giving the data isn't particularly effective. — billinghurst  sDrewth  13:06, 10 March 2016 (UTC)

Strange graph given the available data
The dataset below is rendered by Graph:PageViews at nowiki and shows up as the graph to the right. But this is (sorry) wrong.

This dataset is a copy of data from.

A closer look reveals that the graph is smoothed over missing data (?), and then truncated (?), which gives a wrong impression. — Jeblad 6. mar. 2016 kl. 00:52 (CET)


 * , yes, this is a limitation of the Vega graphs and/or pageview api - if data is missing, pageview api does not return any values, and graph simply draws the line between all known points - e.g. if there is data on day 1,2, and 8, it will draw two lines: between 1st and 2nd day, and between 2nd and 8th day (smoothing it in the process). Graph does not insert any extra values. There has been some talks about it in the Vega community, so when something like that gets implemented, we can use it. In the mean time, the only thing we can do is ask pageview api to insert 0s, at least (in my example) as day 3 and day 7, thus drawing a line for 0. CC: . --Yurik (talk) 13:47, 9 March 2016 (UTC)
 * Missing data is Imputation (statistics), and it is a large field. Replacing missing data with zero (0) is only a partial solution.
 * My main concern with the graph is not missing data, but that the shown data is actually wrong. In this case there are three values for three consecutive days, with values 12 - 4 - 5. Compare this with the graph and it does not make sense at all. Jeblad (talk) 11:35, 10 March 2016 (UTC)
 * I added interpolation template parameter. Set it to "linear" to disable. --Yurik (talk) 20:12, 5 December 2016 (UTC)

Encoding error
@Yurik: Encoding error when we request a page with  apostrophe (double encoding?). Example: n:ru:Викиновости:Статистика страниц/Men's Health назвал сотню самых сексуальных женщин 2013 года. --sasha (krassotkin) 07:04, 9 March 2016 (UTC)
 * , thanks, tracking. --Yurik (talk) 13:36, 9 March 2016 (UTC)
 * , see following discussion. --Yurik (talk) 20:50, 16 May 2016 (UTC)

Sanitazing bug
Hello,. There is a bug in the template. try "Hello, World!" program. The code works well. The code on the article page, using default, does not work. Could you check this, please? IKhitron (talk) 21:39, 9 May 2016 (UTC)
 * , same bug as above - basically there is no good way right now for the urlencode magic keyword to produce something that is easy to use by the graph. I think we will have to implement a new magic keyword for it. --Yurik (talk) 00:52, 10 May 2016 (UTC)
 * Thank you, . But there is a hope over there. Could you please provide us a patch: A little Lua function code which encodes the default call to magic word exactly as your template needs it? The invocation can be simply added to the template code, in #ifexists-module, if needed. As I can see, all this work will take you about five minutes. Thanks again. IKhitron (talk) 09:26, 10 May 2016 (UTC)
 * ? If you have no time, I can do this. IKhitron (talk) 12:58, 15 May 2016 (UTC)
 * sorry for the delay, have been swamped a bit. The page name should simply be "path-encoded", without any magical HTML symbols like &amps;amps; instead of &apms;. Don't confused with query-encoded which is similar but which does not encode the '/' symbol. For path encoding, the '/' has to be encoded as well. Still, I'm fairly unhappy with requiring a magical module which will have to be copied to all wikis just like the graph itself. We really ought to have a shared template and module system. --Yurik (talk) 01:49, 16 May 2016 (UTC)
 * I can understand your unhappiness, . But while enwiki has say 12 wrong names, our hewiki has thousands. What do you thing about one more procedure to the module which runs your graphs template instead? If it is not there, the encoding will not be done. IKhitron (talk) 08:34, 16 May 2016 (UTC)
 * , please copy Module:Graph to he:%D7%99%D7%97%D7%99%D7%93%D7%94:Graph -- seems like the page is locked for some reason. If you want to change any code, please do it in dewiki and let me know, i will copy it everywhere else. Thanks! --Yurik (talk) 15:15, 16 May 2016 (UTC)
 * Thank you very much, ! It works well. But what about the wikis that have pageviews and do not have module:graph. Don't you need some #ifexists? IKhitron (talk) 17:45, 16 May 2016 (UTC)
 * , I plan to add Module:Graph to all wikis, but the ifexists might also be a good approach. --Yurik (talk) 17:47, 16 May 2016 (UTC)
 * So i believe you should add it now to media wiki pageviews origin, and remove after your plans will be done :-) IKhitron (talk) 17:49, 16 May 2016 (UTC)
 * In process :) --Yurik (talk) 17:51, 16 May 2016 (UTC)

,, I updated the pageviews graph in en,he,ru wikis to an alternative parsing proposed by. Please see if it works, and if so, I will close the bug and update all other wikis. Thanks! --Yurik (talk) 03:23, 17 May 2016 (UTC)
 * Yes, it works well. And indeed, it's much better then my version. Even if I still do not understand why does it work ar all., you are brilliant, as usual. IKhitron (talk) 10:26, 17 May 2016 (UTC)
 * Thank you for the praise, but I merely read and applied the documentation. :) Matma Rex (talk) 11:18, 17 May 2016 (UTC)