See pageviews.wmcloud.org for pageview graphs while built-in graphs are being repaired.

This template displays two page view graphs and is designed for articles with spiky page views; that is, articles that are mostly stable but may trend or go viral for short periods due to media attention or innate periodicity of the topic. The template reports daily page views in two stacked graphs (default: the last six months in log scale on the top, and the last 30 days in linear scale below), placing them in a suitable frame with individual headings. It is typically placed on an article's talk page below other talk page banners. Non-trending pages with stable viewership over time do not need to use this template; try the simpler {{Annual readership}} template instead.

Usage

edit

Basic syntax:

{{Page views double}} – one six-month log-scale graph on top, one 30-day linear-scale under it
{{Page views double|days1=365|days2=60}} – change to one year on top, two months on bottom
{{Page views double|365|60}} – same as above, using positional params |1= and |2=

Template syntax with optional parameters:

{{Page views double|expanded=|target=|title=|days1=|days2=|color1=|color2=|scale1=|scale2=|width=|height=}}

Optional parameters

edit

Overall parameters:

  • |expanded= can be used to override the default auto-collapsing of the message box. To prevent the graph from being collapsed on page load, use |expanded=true.
  • |target= (default: {{SUBJECTPAGENAME}}) can be used to simultaneously specify the page in the graph title (if |title= is not specified) and the page for which page traffic is displayed.
  • |title= (default: see notes) can be used to specify the page in the graph title.
  • |width= (default: 570) may be used to change the width in pixels of the image.
    Note: Default of 570px is used to match standard Talk page boxed items; values outside the range of 400–980 may be problematic.
  • |height= (default: 200) may be used to change the height.

Top graph:

  • |days1= (default: 182) can be used to change the number of pageview days depicted in the graph. Alias: |1=.
  • |color1= (default: #f30) can be used to change the graph color; accepted inputs include HTML color names (e.g., red, slategray, cornsilk) and hex codes (e.g., #0080ff, #fc0).
  • |scale1= (default: log) can be used to change the scale of the y axis; accepted inputs: linear, log, pow, sqrt, quantile, quantize, and threshold.

Bottom graph:

  • |days2= (default: 30) pageview days in bottom graph. Alias: |2=.
  • |color2= (default: #0c6) graph color for bottom graph.
  • |scale2= (default: linear) can be used to change the scale of the y axis; accepted inputs: linear, log, pow, sqrt, quantile, quantize, and threshold.

Notes about the graph title

edit

If neither |title= or |target= are specified, the graph title varies depending on the namespace of the page where this template is used.

  • Title if placed on an article talk page:
    Daily pageviews of this article
  • Title if placed on a page in any other talk namespace (e.g., "User talk:", "Template talk:", "Wikipedia talk:", etc.):
    Daily pageviews of {{SUBJECTPAGENAME}}
  • Title if placed on any subject page (i.e., pages in namespaces like "User:", "Template:", "Wikipedia:", etc.):
    Daily pageviews of this page

If |title= is not specified, but |target= is specified, the graph title is set as "Daily pageviews of target page", with the target page linked.

  • For example, inputting |target=XYZ would set the graph title as:
    Daily pageviews of XYZ

If |title= is specified, regardless of the specification of |target=, the graph title is set as "Daily pageviews of text", with the text unlinked.

  • For example, inputting |title=XYZ would set the graph title as:
    Daily pageviews of XYZ
  • For example, inputting |title=[[XYZ]] would set the graph title as:
    Daily pageviews of XYZ

Examples

edit
Template defaults (collapsed)

{{Page views double}} produces:

Template with a specified target page, shorter period in the top graph, and cobalt blue coloring in the bottom graph (collapsed)

{{Page views double|days1=150|target=Pancake|scale=log|color2=cobalt}} produces:

For comparison, here's the same template as above except with both graphs in linear scale:


Template with a target page with very spiky results, two-year period in the top log scale graph, (collapsed)

{{Page views double|target=Diwali|days1=730|days2=45}} produces:

Template with a specified target page, linear scale and same color in both graphs (uncollapsed)

{{Page views double|target=Rubber duck|color1=maroon|scale1=linear|color2=maroon}} produces:


Flip the graphs so the reddish, six-month interval log scale graph is on the bottom (collapsed)

{{Page views double|target=Rubber duck|days1=30|days2=182|color1=#0c6|color2=#f30|scale1=linear|scale2=log}}

Template parameters

edit
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Page views double in articles based on its TemplateData.

TemplateData for Page views double

This template inserts two vertically stacked graphs of daily pageview statistics (Y axis) over the past N days (X axis) for a page.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Targettarget

May be used to specify the page for which page traffic is displayed, and the title (if empty).

Default
Name of the current article page
Example
Main Page
Page nameoptional
Titletitle

May be used to specify the page name in the graph title (for default, see doc)

Default
(varies per namespace, if none specified; see doc)
Stringoptional
Number of days back1

Number of days back to show in the top chart

Default
182
Numberoptional
Number of days back to show in bottom chart2

Number of days back to show in bottom chart

Default
30
Numberoptional
Graph color for top chartcolor1

Shade with which to highlight the data in the top chart

Default
#f30
Example
#f00
Stringoptional
Graph color for bottom chartcolor2

Shade with which to highlight the data in the bottomchart

Default
#0c6
Example
#f00
Stringoptional
Graph scale for top chartscale1

Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold

Default
log
Example
linear
Stringoptional
Graph scale for bottom chartscale2

Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold

Default
linear
Example
log
Stringoptional
Expandedexpanded

Set to true to override the default collapsed state

Default
false
Booleanoptional
Widthwidth

Width for the chart in pixels, if different from the default.

Default
470
Numberoptional
Heightheight

Height for the chart in pixels, if different from the default.

Default
200
Numberoptional

Redirects

edit

See also

edit