How to track Article Analytics through API (views and readings)
This article is dedicated to knowledge bases that are not managed by Helpjuice itself, but rather use our APIs to retrieve content.
Helpjuice does not have dedicated API endpoints for incrementing views and readings under the "/api" section. However, if you are using our API to show content outside of Helpjuice you can user the same endpoints that we use to keep tracking analytics.
The endpoints are:
Endpoint | Description |
POST /questions/QUESTION-ID/analytics/DATE/views |
Increment question views for the given date |
POST /questions/QUESTION-ID/analytics/DATE/readings |
Increment question readings for the given date |
POST /questions/QUESTION-ID/analytics/DATE/seconds_spent?t=SECONDS-PAST | Increment time spent in a question |
POST /categories/CATEGORY-ID/analytics/DATE/views |
Increment category views for the given date |
Parameters:
Parameter | Type | Description |
QUESTION-ID |
Integer | The ID of the question/article for which you want to track analytics |
DATE | Date (YYYY-MM-DD) | The date on which analytics will be affected. This needs to be from yesterday to tomorrow. Helpjuice does not accept dates far in the past or the future. When an invalid date is provided, we'll use Today. |
SECONDS-PAST | Integer | The amount of seconds you want to increase the Time Spent metric by. The limit is 120s and we recommend stop tracking this metric after the user stayed for over a few minutes in the page. Someone might have forgotten it open and left, if you keep tracking the numbers will be very high. |
CATEGORY-ID | Integer | The ID of the category you want to track analytics for. Categories can only track views. |