Extension:CentralNotice/Statuses, reasons and status codes

From mediawiki.org

CentralNotice registers its current status at certain times during while determining a user's eligibility for a campaign and a banner. It may also register a reason for the status having been set. These data points are set as status and reason in the mw.centralNotice.data object, and may be inspected via the browser's JavaScript console.

Both are also sent to the server via the call to beacon/impression. (However, if a status is erroneously set after that call occurs, only the previous status is registered server-side.)

status and reason are also condensed into a single field, status_code, made up of two numbers, separated by a dot. The first number is a code for the status, and the second is a code for reason.

status_code is available as a dimension in the WMF's Druid data store on banner activity, and may be queried via Pivot.

Available statuses, reasons and codes[edit]

Following is an overview of currently available statuses and reasons, with their corresponding codes.

To find the meaning of a status code, look up the first number in the Statuses table, and the second number in the Reasons table. For example, code 2.1 indicates banner_canceled status with closed as the reason (i.e., no banner was shown because the user had a cookie indicating that a banner in a campaign with the same category was closed by the user on a previous pageview, within a specified period of time).

Currently the CentralNotice API allows reasons to be attached to statuses 2 or 5. Code in banners often provides reasons as strings, and sometimes those strings don't match any reason known to CentralNotice code; in such cases, the other reason (0) is set in the status code.

Please see ext.centralNotice.display.state.js for the most up-to-date codes.

Statuses[edit]

Code Status Meaning
0 campaign_not_chosen Initial status, set when CentralNotice starts to determine if the user is eligible for a campaign.
1 campaign_chosen It has been determined that the user is eligible for a campaign and one has been chosen.
2 banner_canceled Though the user is in a campaign and a banner may be available, it has been determined that a banner should not be shown. Normally, a reason is provided.
3 no_banner_available Though a banner should be shown, none of the banners assigned to the campaign are available for this user, due to the user's device, logged-in status or bucket. In most cases, this code indicates a mistake in campaign configuration. (Note: When this code is set, the reason field in mw.centralNotice.data is set to empty for legacy purposes, though no reason code is included in the status code.)
4 banner_chosen A banner has been selected for the user. (The background call to load the banner is made shortly after this status is set.)
5 banner_loaded_but_hidden The banner was loaded and injected into the page, but code in the banner indicated that the banner was not actually displayed to the user. A reason is normally set.
6 banner_shown The banner was loaded and displayed to the user. (Important catch: If a complex banner hides itself and does not register this correctly with CentralNotice before the call to beacon/impression is sent, this status may appear in analytics data, even though the banner wasn't really shown.)
7 banner_loader_error The banner content was requested from the server, but an HTTP error code was received.

Reasons[edit]

Note: Many reasons are legacy and not in use with current banners, though not actually deprecated. For any codes whose meanings are not explained here, please see the in-banner JavaScript that sets them.

Code Status Meaning
0 other CentralNotice does not have a code for the reason provided.
1 close On a previous pageview within a specified time period, the user clicked on the close button of a banner in a campaign with the same category, as indicated by a cookie in the user's browser.
2 waitdate The user has reached the maximum number of banner impressions for this campaign (or impression diet identifier) within a specified time period. Banners will only be shown again for this campaign once the period has elapsed.
3 waitimps The user has not reached the minimum number of pageviews for this campaign (or impression diet identifier) for a banner to be shown.
4 waiterr Deprecated.
5 belowMinEdits The user did not have the required number of edits to see the banner.
6 viewLimit
7 'seen-fullscreen'
8 'cookies-disabled'
9 donate A cookie in the user's browser indicates that they donated within the past year.
10 cookies
11 seen
12 empty
13 waitnorestart Deprecated.
14 waitnostorage The impression diet feature didn't have a way to store pageview and impression counts in the user's brower.
15 namespace
16 noStorage The banner sequence feature didn't have a way to store data in the user's brower.
17 requestedBannerNotAvailable A request was made through the CentralNotice API (usually by the banner sequence feature) for a specific banner, but that banner is not available for this user.
18 jsonParamError Error in the configuration data received by the banner sequence feature.
19 bannerSequenceEmptyStep The user is currently on an empty step in a banner sequence.
20 bannerSequenceAllStepsSkipped All the steps in a banner sequence have been skipped due to identifiers in the user's browser indicating that they all should be skipped. (May indicate an error in campaign configuration.)