RailWAM

**RailWAM** provides several features for wikis to monitor their daily score on the Wiki Activity Monitor (WAM), including a right rail module. Every wiki has a WAM score between 0 and 100 based on its activity, and wikis that rise to the top are displayed on the official WAM page. With RailWAM, users can track their wiki's growth and the effect of real-world events on wiki activity.

## Features

What's New in 3.0
* Graphing tool
* Log old data tool
* Streamlined database interface
* Ability to search for score, rank, and vertical rank ranges
* Date pickers in all tools
* Dashboard
* New configuration options: `doubleCheckDelay` and `showChange`
* Numerous bug fixes

- Auto-updating right-rail module

- Displays latest score and rank data

- Displays score and rank increase/decrease from yesterday

- Logging WAM data daily with the click of a link (or by simply visiting the wiki with the `autoLogForUsers` option)

- Searchable WAM data with the RailWAM database

- Graphing tool

- Log old data tool

- FAQ opened with one click on a link at the bottom of the module

- Link to the official WAM page with the top 5,000 wikis' scores

- Configuration options

- Suggest a feature!

## Installation

If you are installing RailWAM for **sitewide use**, first add the following code to MediaWiki:Common.js. **Submit it for security review** in the "Custom JavaScript status" rail module.

```
window.railWAM = {
 logPage:"Project:WAM Log"
};

```

Then, for both **sidewide and personal** installation, add the relevant code that has been provided in the box below.
Template:Script Install

## Configuration

### Option List & Defaults

Click "Expand" at the right to see details for each of RailWAM's available configuration options.

#### `appendAfter`

##### Description

Rail modules to append RailWAM after

Modules do not have to exist on all pages. RailWAM is appended to the module specified in this option that is furthest down the page, or below ads if no specified modules are found.

**This can not be changed to place RailWAM before ads.**

##### Accepted Values

* The ID or class of a rail module as a string (e.g. `"#wikia-recent-activity"`)
* IDs or classes of rail modules in an array (e.g., `['#wikia-recent-activity','.chat-module']`)

#### `autoLogForUsers`

##### Description

Users for whom the WAM will be automatically logged, if it is not already, when they visit the wiki.

**Do not add a user to this without their permission.**

##### Accepted Values

* The name of one user as a string (e.g. `"Example"`)
* The names of multiple users as an array (e.g. `["Example","Another Example"]`

#### `botUsers`

##### Description

Users for whom the edit to log WAM data will be marked as a bot edit.
**The user must have a bot flag on their account in order for the edit to be marked.**

##### Accepted Values

* The name of one user as a string (e.g. `"Example"`)
* The names of multiple users as an array (e.g. `["Example","Another Example"]`)

#### `doubleCheckDelay`

##### Description

This option only applies to wikis not in the top 5000 WAM ranks. It defines when RailWAM double checks logged WAM data by sending another request to FANDOM's data. This improves data accuracy if the WAM scores are updated late, but the extra request can slow down page load times on slow Internet connections.

For example, the default value is 4 hours. RailWAM will double check data when someone visits the wiki within 4 hours after midnight. Then, it will stop checking for the next 4 hours. RailWAM will alternate between checking and not checking for the whole day based on the option value.

Note that even if RailWAM finds new data, a user must click the log button in the rail module log alert to update it.

Setting this to `24` will make RailWAM double check data for the entire day.

#### `logPage`

##### Description

The name of the page RailWAM should log the scores to

##### Accepted Values

Page name as a string (i.e. surrounded in quotes)

#### `loadOnPage`

##### Description

The name(s) of the page(s) RailWAM should load on

##### Accepted Values

* The name of one page as a string (e.g. `"Example"`)
* The names of multiple pages as an array (e.g. `["Example","Another Example"]`)

#### `loadOnNamespace`

##### Description

The ID(s) of the namespace(s) RailWAM should load on

See Namespace IDs for a list of namespaces and their IDs

##### Accepted Values

* The ID of one namespace (e.g. `1`)
* The IDs of multiple namespaces as an array (e.g. `[1,2,3]`)

#### `lang`

##### Description

Defines which language RailWAM should use

##### Accepted Values

Two letter language codes as a string (i.e. surrounded in quotes)

##### Default

Language set in the user's preferences or `"en"` if that language is not supported

#### `showChange`

##### Description

Whether RailWAM should show the increase/decrease in WAM score and rank since yesterday.

#### `showLogAlert`

##### Description

Whether or not to display the alert asking you to log WAM scores

#### `showToAnons`

##### Description

Whether the rail module should be shown to anonymous users

#### `top5000Mode`

##### Description

If the side module for your wiki does not consistently display a rank (i.e., your wiki is not in the top 5000 WAM ranks), you should set this to `false`. This tells RailWAM to skip an extra data request and may improve loading time.

### How to Configure

RailWAM can be configured with code placed in MediaWiki:Common.js (site-wide use), your common JavaScript on a particular wiki (personal use), or your global JavaScript (personal use).

If you are using RailWAM site-wide, please see this important note.

If you are using RailWAM personally, please see this important note.

You can use `**window.railWAM**` to configure RailWAM. If you don't know what this means or how to use it, expand and read the detailed guide below.

### Detailed Configuration Guide

Press *[Expand]* at the right to open the detailed configuration guide.

#### **Adding one option**

RailWAM stores configuration options in `**window.railWAM**`. Thus, you must first add this to to the code page with the same spelling and capitalization, unless a `window.railWAM` is already present:

```
// RailWAM configuration
window.railWAM = {
};

```

Next, you need to add configuration options to `window.railWAM` as properties. Move your cursor to the **left (first) brace after the equal sign**. Press **enter/return**. Then, **type in the name of an option** exactly as it appears in the list of configuration options above (same spelling, same capitalization, etc.). `logPage` will be used in this example:

```
// RailWAM configuration
window.railWAM = {
 logPage
};

```

Next, **add a colon** **and** **a space** after the property name:

```
// RailWAM configuration
window.railWAM = {
 logPage:
};

```

Now you can **add the value** for the option. The list of configuration options above shows what values are accepted for a particular option. For `logPage`, a string (word(s) surrounded in single or double quotes) with the name of a page on the wiki will work.

Remember that **you must surround any words you enter for values besides *true* and *false* in single or double quotes**. Otherwise, what you have entered will be interpreted as a variable, which is something entirely different and will produce errors. Refer to the list above if special values need to be entered.

```
// RailWAM configuration
window.railWAM = {
 logPage: 'My log page'
};

```

If you add multiple options, you *must* **add a comma** after the value for each option. (If it is a string, it must be after the end quote.) Even if you are only using one option, it is still best practice to add a comma so that you do not have to remember in case you add more options later:

```
// RailWAM configuration
window.railWAM = {
 logPage: 'My log page',
};

```

#### **Adding more options**

More options should be added to the same `window.railWAM`.

After **placing a comma** after the first option, press **enter/return** to start on a new line. Then follow the steps you used to add the first option: enter the **option name** exactly, enter a **colon** and a **space**, enter the **value**, and end with a **comma**. For example:

```
// RailWAM configuration
window.railWAM = {
 logPage: 'My log page',
 loadOnPage: 'Special:WikiActivity',
 lang: 'pl',
};

```
It is best practice (but not required) to keep the configuration options in alphabetical order to make them easier to find. After moving any options around, make sure no letters, colons, quotes, commas, etc. have been lost or misplaced.

### Important Note for Site-wide Use

To keep users safe, all site-wide code changes must be submitted to the code review team for a security check. After you press "Publish" to save your changes, click on the "Submit for review" button in the "Custom JavaScript status" module in the right rail on the code page. The code typically takes no longer than a few days to review. Once the revision has been approved, your changes will go into effect automatically.

### Important Note for Personal Use

If you are installing the script for personal use, make sure you place the configuration options before the import statement:

```
// This is an example configuration
window.railWAM = {
 logPage: 'My log page',
 loadOnPage: 'Special:WikiActivity',
 lang: 'pl',
};

// importArticles call
importArticles({
 type: 'script',
 articles: [
 'u:dev:MediaWiki:RailWAM/code.js'
 ]
});

```

## Frequently Asked Questions

### It's not working!

Please ensure that you have read the documentation clearly. If it is still not working, submit a bug report. If there is a section of the documentation that is unclear or confusing, please include that in your report too.

### Why isn't my wiki's WAM rank showing?

Wikia only assigns WAM ranks to the top 5000 wikis. Most likely, your wiki is not one of these wikis. RailWAM automatically hides the rank section of the module if there is no rank data to be found.

If you are sure that your wiki's WAM rank should be showing, please submit a bug report.

### How do I access the RailWAM database/graphing tool/old data logger?

You can access these tools from the RailWAM Dashboard, a link to which can be found at the bottom right of the rail module.

You can also access these tools directly with their URLs by replacing **YOURWIKI** with your wiki's prefix. The page names are the same for all languages.

* Database: https://**YOURWIKI**.wikia.com/wiki/Special:BlankPage/RailWAM/Database
* Graphs:https://**YOURWIKI**.wikia.com/wiki/Special:BlankPage/RailWAM/Graph
* Logger: https://**YOURWIKI**.wikia.com/wiki/Special:BlankPage/RailWAM/Log

### Why aren't any database entries being returned? / Why are there gaps in database data?

RailWAM gathers data from different places for wikis in the top 5000 WAM ranks (the WAM index) and wikis that are not in the WAM index. Unfortunately, historical data can not be retrieved for wikis not in the WAM index; it can only be retrieved if the data is logged by the user.

It is also possible that Wikia has not updated the WAM for that day. This occurs from time to time, but it is not a problem caused by or solvable by RailWAM.

### Full data for my wiki displays without it being logged. Why should I log WAM data?

Logging data for such a wiki is important because it can significantly reduce the amount of data requests RailWAM has to make, meaning faster load times. Logging data particularly speeds up the database and graphing tool where each request for every day takes 10 seconds. For example, a request for two weeks of data would take over two minutes if no data is logged. Simply logging data every data could reduce this time to less than a second.

### My question wasn't listed here.

RailWAM has its own FAQ with a "FAQ" link located in the bottom left of the module with more information about WAM and RailWAM in general and how to use RailWAM's database. If you are looking for this type of information, please see that FAQ.

If you have looked at the FAQ in the module, please leave your question on RailWAM's talk page.

## Submitting Bug Reports/Suggestions

Please submit all bug reports and suggestions on RailWAM's talk page. For bug reports, include a link to your wiki and specific description of the problem. Images may also be helpful to illustrate visual issues.

Replies to messages on the above talk page are left on that same talk page, typically during weekends. However, bugs will most likely take longer to solve and fixes may take a few days to be approved. Please continue to check on the message you left on the talk page until the bug is fixed in case additional clarification or notification is necessary.

If your message has been left unanswered for more than a week, leave a note on Blaster Niceshot's (author's) talk page. Your message will be answered during the upcoming weekend, if not sooner.

Thank you for contributing to RailWAM!

## Submitting Translations/Corrections

You can submit/edit translations for RailWAM using the translations editor.

Thank you for contributing to RailWAM!

## Planned Features

**General features**

* Inline-article WAM modules

**Database features**

* Allow comma to be used as decimal separator

**Graphing features**

* Graph statistics

## Opting Out of RailWAM

To opt out of RailWAM, add this to your personal JavaScript (on the wiki you want to hide it) or global JavaScript:

```
window.railWAM = {
 load: false,
};

```

## For Developers

Documentation for the RailWAM Library is under construction. Please check back soon.