Getting the view or download count using the Tracking Data Supplier
Scenario
This guide shows you how to get the view or download count for attachments using Reporting for Confluence and the Tracking Data Supplier.
This example requires the Reporting for Confluence app to also be installed on your Confluence instance.
Result
Recipe
Apps | Tracking, Reporting for Confluence |
---|---|
Platform |
|
Level | Intermediate |
Estimated time | 10 |
Macros |
|
Suppliers |
|
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
Create a Report Table macro.
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 totrue
.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.Within the Report Table macro, and under the Content Reporter macro, create a Report Column macro.
Set the Title parameter to "Attachment Title
".Within the Report Column macro, create a Report Info macro.
Set the Key parameter to "attachment:title
".
Set the Link To Item parameter toTrue
.Create another Report Column macro under the other one.
Set the Title parameter to "Download Count
".Within the Report Column macro, create a Report Info macro.
Set the Key parameter to "track:view count
".
Line-by-Line Explanation
N/A