App Usage Report Script

We currently do not have a standard usage report. We have created this tutorial for clients to perform at their end to get an overview of their usage of ZenUML Addon on their Confluence cloud instances.

Please note the script on this page is provided as is and is NOT covered by our product’s terms and conditions. The script is reasonably safe to run but it runs on behalf of the user, so adopting all their permissions. It hasn’t been tested thoroughly on many instances.

What does it do?

This script reports all the pages on your confluence instance. It may take a while if you have many pages. It will scan ALL spaces (not just the current space). It will print out all the pages that have a ZenUML macro on it. A ZenUML macro could be:

  1. A ZenUML Sequence Diagram, or

  2. A Mermaid Diagram, or

  3. A Graph (compatible with DrawIO), or

  4. An Open API Document, or

  5. An embedded document of one of the above.

Where to run?

This script assumes medium level of front end knowledge. You need to open a Confluence page. It does not need to be a page that contains a ZenUML macro. Paste the following script on the browser’s developer console (Chrome is a recommended browser):

// This script is used to scan all pages in a Confluence space to find pages containing ZenUML macros. // It's intended to be manually executed in the browser developer console. (function () { const body = page => JSON.parse(page.body.atlas_doc_format.value); const has = body => body.content.filter(c => c.type === 'extension' && c.attrs.extensionType === 'com.atlassian.confluence.macro.core' && c.attrs.extensionKey.indexOf('zenuml-') === 0); const process = response => response.results.filter(p => has(body(p)).length > 0).map(p => `${response._links.base}${p._links.webui}`); const scan = url => fetch(url).then(r => r.json()).then(r => { console.log(process(r)); return r; }).then(r => r._links.next && scan(`${r._links.context}${r._links.next}`)); scan(`/wiki/rest/api/content?expand=body.atlas_doc_format&limit=10`); })();

All new versions of this script will be published at https://github.com/ZenUml/confluence-plugin-cloud/blob/master/scripts/scan_zenuml_pages.js.

Below is a screenshot of how it should look like after execution.

Script explained

What is ZenUML for Confluence?

ZenUML is a leading solution on Confluence for diagraming and API documentation. ZenUML was born from a Finance project and is widely used in Bank, FinTech, Telecom, and Retail companies. From day one, we built ZenUML in a way that no data is sent to our server for rendering including image-export. No personal data is stored, transmitted, or otherwise processed by ZenUML’s server.