Universal Language Selector/Compact Language Links/metrics

This page describes the scripts and queries for collecting data about Interlanguage links, especially in the context of Compact Language Links. For the collected data, see the page Universal Language Selector/Compact Language Links/metrics/data.

Measuring interlanguage links clicks
For getting information one day before, run:

For a particular date, run (note: no leading zeros in the date):

The output will be in the files with names such as prev_wikipedia_2016_7_7.out and curr_wikipedia_2016_7_7.out, where "prev" is for the source language and "curr" is for target language.

Copy the results from the .out file to a text editor, and then copy them from the text editor to the relevant column in the spreadsheet.

Updating daily data
THIS IS ON THE WAY TO DEPRECATION, AND MOVING TO QUERIES, SEE BELOW

Get the pageviews data for the projects that are measured:
 * Wikipedia 1: https://tools.wmflabs.org/siteviews/?platform=desktop&source=pageviews&agent=user&range=latest-10&sites=af.wikipedia.org|als.wikipedia.org|bn.wikipedia.org|ca.wikipedia.org|cs.wikipedia.org|da.wikipedia.org|de.wikipedia.org|eo.wikipedia.org
 * Wikipedia 2: https://tools.wmflabs.org/siteviews/?platform=desktop&source=pageviews&agent=user&range=latest-10&sites=es.wikipedia.org|fr.wikipedia.org|he.wikipedia.org|hi.wikipedia.org|hr.wikipedia.org|it.wikipedia.org|lv.wikipedia.org|pt.wikipedia.org
 * Wikipedia 3: https://tools.wmflabs.org/siteviews/?platform=desktop&source=pageviews&agent=user&range=latest-10&sites=se.wikipedia.org|sq.wikipedia.org|ta.wikipedia.org|zh-yue.wikipedia.org|zh.wikipedia.org|zu.wikipedia.org
 * Wikivoyage: https://tools.wmflabs.org/siteviews/?platform=desktop&source=pageviews&agent=user&range=latest-10&sites=de.wikivoyage.org|en.wikivoyage.org|es.wikivoyage.org|fr.wikivoyage.org|it.wikivoyage.org|ru.wikivoyage.org

Copy the results to the relevant cells in the spreadsheet.

Adding a new language for calculating percentage of clicks out of views

 * 1) Find the right place, alphabetically, for the language to appear.
 * 2) Select all the rows for the language before which you want to add another one, including an empty row after it.
 * 3) Copy (Ctrl/Command).
 * 4) Right-click on the row numbers and click "Add rows above: 7".
 * 5) Select the added rows. Paste (Ctrl/Command).
 * 6) Change the language code in the first pasted row.
 * 7) Go to https://tools.wmflabs.org/siteviews/
 * 8) Select a range of initial dates that you want to backfill.
 * 9) Type the project name. The need chart will be shown.
 * 10) Click the CSV button and download the file. Open the CSV file in your desktop spreadsheet software.
 * 11) In your desktop spreadsheet software, select the numbers for the relevant dates and Copy (Ctrl/Command).
 * 12) Go back to the Google spreadsheet. Paste (Ctrl/Command) in some empty space and again Copy (Ctrl/Command).
 * 13) Right-click on the first cell in the "views" row for the new language. Paste special -> Transpose.
 * 14) Update the URLs for pageviews stats in the section on pageviews above.

Query for getting pageviews
From Phab T142505

The clicks query
These queries run from the all_projects.sh script. They are here only for reference.