Scenario

This guide shows you how to get the view or download count for attachments using Reporting for Confluence and the Tracking Data Supplier.

(warning) This example requires the Reporting for Confluence app to also be installed on your Confluence instance.

Result

Recipe

Apps


Tracking, Reporting for Confluence


Platform

  • Confluence Server
  • Confluence Cloud
  • Confluence Data Center
  • Confluence Server and Data Center
  • Confluence Server and Cloud
  • Confluence Server, Data Center, Cloud
  • N/A

Level

Intermediate

Estimated time

10

Macros

  • Attachment Supplier
  • Body Supplier
  • Boolean Supplier
  • Child Counter Supplier
  • Class Supplier
  • Collection Supplier
  • Comment Supplier
  • Content Supplier
  • Date Supplier
  • Debug Supplier
  • Email Supplier
  • Expanded Supplier
  • Global Supplier
  • Grouped Supplier
  • Label Supplier
  • Link Supplier
  • Mail Supplier
  • Map Entry Supplier
  • Map Supplier
  • Match Supplier
  • News Supplier
  • Number Supplier
  • Object Supplier
  • Page Supplier
  • Query Supplier
  • Reference Supplier
  • Report Supplier
  • Request Supplier
  • Salesforce Supplier
  • Scaffold Data Supplier
  • Session Supplier
  • Space Supplier
  • Stats On Supplier
  • Stats Supplier
  • Task Supplier
  • Tasklist Supplier
  • Text Supplier
  • Tracking Data Supplier
  • User Group Supplier
  • User Supplier
  • Value Supplier
  • Variable Supplier

Suppliers

  • Attachment Supplier
  • Body Supplier
  • Boolean Supplier
  • Child Counter Supplier
  • Class Supplier
  • Collection Supplier
  • Comment Supplier
  • Content Supplier
  • Date Supplier
  • Debug Supplier
  • Email Supplier
  • Expanded Supplier
  • Global Supplier
  • Grouped Supplier
  • Label Supplier
  • Link Supplier
  • Mail Supplier
  • Map Entry Supplier
  • Map Supplier
  • Match Supplier
  • News Supplier
  • Number Supplier
  • Object Supplier
  • Page Supplier
  • Query Supplier
  • Reference Supplier
  • Report Supplier
  • Request Supplier
  • Salesforce Supplier
  • Scaffold Data Supplier
  • Session Supplier
  • Space Supplier
  • Stats On Supplier
  • Stats Supplier
  • Task Supplier
  • Tasklist Supplier
  • Text Supplier
  • Tracking Data Supplier
  • User Group Supplier
  • User Supplier
  • Value Supplier
  • Variable Supplier



Storage format

You can copy and paste this code into the Confluence Source Editor:

This report table will list the download count of all docx file/attachment. attachment .*docx.* attachment:title Attachment Title true attachment:title Download Count track:view count

<ac:structured-macro ac:macro-id="964f1b9f-c5f2-4c1e-b3ed-fe76af62f145" ac:name="info" ac:schema-version="1">
  <ac:rich-text-body>
    <p>This report table will list the download count of all docx file/attachment.</p>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="6c309ed4-b41f-488d-a078-2893681809e2" ac:name="report-table" ac:schema-version="1">
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="4dab151d-1c7a-423c-8f7f-6d2e8c594ceb" ac:name="content-reporter" ac:schema-version="1">
      <ac:parameter ac:name="types">attachment</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="c610f612-b633-40b9-9fa5-09b5ba436d53" ac:name="text-filter" ac:schema-version="1">
            <ac:parameter ac:name="include">.*docx.*</ac:parameter>
            <ac:parameter ac:name="">attachment:title</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="05df1cb2-6664-40f0-9be9-246be2cfa2e8" ac:name="report-column" ac:schema-version="1">
      <ac:parameter ac:name="title">Attachment Title</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="a90637f1-35e6-4d58-97f9-9539a96952b5" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="link">true</ac:parameter>
            <ac:parameter ac:name="">attachment:title</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="24510e81-aae6-40c4-8aec-2fe2b991b327" ac:name="report-column" ac:schema-version="1">
      <ac:parameter ac:name="title">Download Count</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="cecaa9c7-2715-4c7a-b812-e56a9ad28ec2" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="">track:view count</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>

Macro structure

You can recreate the example in the editor view:

Steps

  1. Create a Report Table macro.

  2. Within the Report Table macro, create a Content Reporter macro.
    Set the Spaces parameter to "@self".
    Set the Types parameter to "attachment".
    Set the Match All Criteria parameter to true.

  3. Within the Content Reporter macro, create a Text Filter macro.
    Set the Key parameter to "attachment:title".
    Set the Include parameter to ".*docx.*". This is to filter attachments to only .docx files.

  4. Within the Report Table macro, and under the Content Reporter macro, create a Report Column macro.
    Set the Title parameter to "Attachment Title".

  5. Within the Report Column macro, create a Report Info macro.
    Set the Key parameter to "attachment:title".
    Set the Link To Item parameter to True.

  6. Create another Report Column macro under the other one.
    Set the Title parameter to "Download Count".

  7. Within the Report Column macro, create a Report Info macro.
    Set the Key parameter to "track:view count".

Line-by-Line Explanation

N/A