How Can I Track Page Views for Every Page in a Space?

I'd like to know how I can track page views for each page in a given space. I found the Google Analytics plugin, but this requires adding the code to every single page which is not feasible. 

I'd like to be able to see the most and lead viewed pages at a glance. Any thoughts?

2 answers

0 vote
Zak Laughton Atlassian Team Dec 26, 2017

Hi Alain! A third-party app from the Atlassian Marketplace is the best option to track views of every page (e.g. Page View, Viewtracker).

You can enable the native Confluence Usage statistics plugin to see the most popular spaces and pages, but this plugin is known to cause performance issues in larger instances and has less functionality for tracking the views of individual pages.

Thanks for you reply, Zak. Both of these, however, only seem to work with Confluence Server, but we are using Confluence Cloud. I'll see if I can find one in the Market Place for Cloud. 

0 vote
Davin Studer Community Champion Dec 27, 2017

If you want to use Google Analytics you could add the code to the Custom HTML section in Confluence Administration. Anything there is run on every Confluence page.

Thanks for your response. I have a few follow-up questions:


1) Is this to be added in the header or footer section of 'Look and Feel?'


2) If the custom HTML does go in the header or footer, will iI receive analytics for each page individually, or is it going to aggregate all the views as one page?

Davin Studer Community Champion Dec 28, 2017

I'd put it in the footer. And it will be as if you had embeded the code on every page. Anything in the custom html section will be run on every page of your site.

Thanks Davin,


     Will putting it in the footer still provide individual statistics for each page, or just an aggregate of views for all pages? 

Davin Studer Community Champion Dec 29, 2017

Not totally sure what you are asking. It is just like embedding the code on any web site in the footer. It will run on each page and report that data to Google Analytics for that page.

I want to make sure that by adding it to the footer, the Google Analytics will show:


Total Site Views - 45

Page 1 - 10 views

Page 2 - 15 views

Page 3 - 20 views


rather than:

Total Site Views - 45, but not individual page stats.

Given your reply, it sounds like it will be broken down by page. Thanks again for your help.

I attempted to added the code for Google Analytics to the footer in Confluence, but receive the following error message on the page:


com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'datalayer.push(arguments);' is unknown.


Any idea what could be wrong? The code I am using is:


<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=""></script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'MYGOOGLEANALYTICSID');

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

374 views 20 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you