Using the Confluence REST API, is there anyway to retrieve pageview count for a given page?
Asked Answered
U

2

17

I am using the REST Confluence API to retrieve a bunch of data around our Confluence pages, such as version, last modified, created, etc. However, I don't see any way to retrieve page views.

Do you know if this is accessible through any of their APIs?

Unicellular answered 14/5, 2012 at 13:43 Comment(1)
You've probably done the basics -- but can you just give a brief sentence or two about why just an analytics script (davidsimpson.me/2009/03/18/…) didn't work for you? I was considering this and dont want to get all the way down the path and run into the problems you might have....Crimple
D
12

ViewTracker Plugin:

By default, no pageviews or page counts are recorded in Confluence due to performance reasons; however, after installing and configuring the Confluence ViewTracker Plugin you will start recording this data.

However, there is no mention anywhere on whether or not this information is available through the API. The plugin doesn't have an API, and it's not clear whether or not the additional information is available via an API. The ViewTracker Documentation does define a macro that returns the count, so the information is clearly stored in the database.

view count - The number of times the content has been viewed since the firstViewed date.

If this information is not returned by an API, then you may need to put in a feature request with the maintainer of the plugin.

Confluence Google Analytics Plugin:

If the ViewTracker plugin does not meet your needs, doesn't have an API, and the developers don't intend to expose one, then your other option is to install the Confluence Google Analytics Plugin.

Unlike ViewTracker, it's not free. However, you do gain programmatic access to this data through Google Analytics. Google exposes a Core Reporting API that would allow you programmatic access to the number of pageviews, visits, and other metrics reported by the analytics code.

Google supplies examples and documentation on how to get the data using Java, PHP, Python, and JavaScript.

Dougie answered 26/5, 2012 at 2:55 Comment(2)
@mliebelt - Right, I'm not sure if the price is for the number of users on the Confluence site or the number of users accessing the analytics. That could make a difference. Also, I was wondering if there was perhaps a way to get Google Analytics on the site by writing your own plugin! When I put GA on my site, it's free, so why couldn't it be free on Confluence as well ;) The developers of that GA Confluence plugin are making quite the profit.Dougie
FWIW, Atlassian had its own Usage Tracking plugin (ecosystem.atlassian.net/wiki/x/AQCRAg) but it's disabled by default for performance reasons. No API in that, as well.Apparitor
B
0

Latest version of ViewTracker now offers a ReST API: https://app.swaggerhub.com/apis/bitvoodooag/Viewtracker/7.1.0#/Reporting/getContentDailyVisits

Bushwa answered 23/9, 2021 at 19:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.