counters.get(name) Last updated: 07. Oct 2024

API only function

Retrieves the current value of a named counter.

Parameters

Name Type Description
name string The name of the counter to retrieve.

Returns

number

Example

Data

Returns the current value of the specified counter as a number.

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
// Get the current value of the 'pageViews' counter
let currentPageViews = counter.get('pageViews');
console.log('Current page views:', currentPageViews);