When I started managing a wiki space, I wanted to find out which sections, or branches of the page tree, were growing the fastest and might need more oversight. But I didn't have any analytics. What next?
Fortunately, I was able to use ServiceRocket's Reporting add-on to generate a workable report. When combined with Confluence's Chart macro, it’s even easier to see where pages are being added. And it all updates dynamically. Here's how I did it.
The basic setup is two pages: one page with a table of numbers populated by the Reporting macro, and one page with a Chart macro, using the Include Page macro to pull the table of numbers in. (This reduced the complexity of the dashboard page where the chart would be located. See DIY metrics for a wiki space dashboard.)
Here a simple table contains the results of my Reporting output. For this demo I used some example pages from my test wiki which had child pages.
Each cell contained the following:
Report Block macro
Inside that, Content Reporter macro
Parameters: Types = page, Scope = Page1>descendants, Match All Criteria = checked
Inside Content Reporter, Date Filter macro
Parameters: Key = content:creation date, After Value = 01-Jan-2019), Before Value = 01-Feb-2019 (for January's numbers)
Inside Report Block, after Content Reporter, Report Header macro
Inside Report Header, Report Info macro
Parameters: Key = report:query>collection:size (this would result in a single number that counted the items meeting the criteria)
After Report Header (still inside Report Block), Report Body macro (necessary for proper report operation)
After Report Body, Report Empty macro
Containing a 0 (zero). (If the report returned no results, the Chart macro would find a 0.)
Here’s how it looks in the Confluence editor.
Here's the wiki markup.
{report-block:atlassian-macro-output-type=INLINE}
{content-reporter:scope=Content and format examples>descendants|types=page}{date-filter:content:creation date|afterValue=01-Jan-2019|beforeValue=01-Feb-2019|format=dd-MMM-yyyy}{content-reporter}
{report-header}{report-info:report:query>collection:size}{report-header}
{report-body}
{report-body}
{report-empty}0{report-empty}
{report-block}
(For my purposes, I used a “wiki markup without migration” macro to made copy and paste easier.)
I saved the page and numbers were generated in each cell! Great! After ensuring the page names and time frames were correct, it was time to build the chart.
Here’s the markup for the Confluence Chart macro at the beginning of the article.
{chart:dateFormat=dd-MM-yyyy|orientation=vertical|rangeAxisTickUnit=1|subTitle=In 2019|timePeriod=Month|timeSeries=true|title=Example pages created by parent|type=line|width=600|xLabel=Month|yLabel=Pages}
{include:The data from Reporting}{chart}
After I had the report and chart working to my satisfaction, I integrated it into the wiki dashboard.
A few notes,
Changed page names must be manually updated in the wiki markup or incorrect numbers will result
I spot-checked a couple of results against the page tree to make sure Reporting was returning the results I expected
I don’t believe previously created, then deleted, pages are included in the reports
The Wikifier RT tool is useful for converting Confluence editor format to wiki markup
I used the same technique to create a couple of other charts, such as average number of versions of pages in a section (turnover), and number of unique page creators by time period. They need some refinement, but are proof of concept that these macros can play together in a useful way. If anyone has ideas for other Reporting/Chart combinations I would like to hear about it.
Michelle Rau HP
Information engineer / technical writer
HP Inc.
Silicon Forest
6 accepted answers
0 comments