Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 791
leora Avatar asked May 14 '12 13:05

leora


People also ask

How do I extract data from a confluence page?

If you've got permission to view the page in Confluence, you'll be able to export it in this way; go to the page and choose (Tools) > Export to PDF.

What is confluence REST API?

Confluence's REST APIs provide access to resources (data entities) via URI paths. To use a REST API, your application will make an HTTP request and parse the response. By default, the response format is JSON. Your methods will be the standard HTTP methods: GET, PUT, POST and DELETE.

How do I call a confluence API?

Modify your app's code to call the Confluence REST API that gets the comments on a page. You'll use the returned array to count the number of comments and write it to the Forge logs. You'll use the Product Fetch API in the runtime to make the REST call. The runtime API simplifies some operations, including HTTP calls.


1 Answers

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.

like image 62
jmort253 Avatar answered Sep 26 '22 22:09

jmort253