Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uttori-analytics-provider-json-file

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uttori-analytics-provider-json-file

Analytics provider for Uttori that uses JSON files.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

view on npm npm module downloads Build Status Dependency Status Coverage Status

Uttori Analytics Provider - JSON File

Uttori analytics provider using JSON files on disk.

Install

npm install --save uttori-analytics-provider-json-file

Config

{
  directory: '',
  name: 'visits',
  extension: 'json',
}

API Reference

AnalyticsProvider

Page view analytics for Uttori documents using JSON files stored on the local file system.

Kind: global class
Properties

NameTypeDescription
configObjectThe configuration object.

new AnalyticsProvider(config)

Creates an instance of AnalyticsProvider.

ParamTypeDescription
configObjectA configuration object.
config.directorystringThe directory to store the JSON file containing the page view analytics.
[config.name]stringThe file name of the file containing the page view analytics.
[config.param]stringThe file extension of the file containing the page view analytics.

Example (Init AnalyticsProvider)

const analyticsProvider = new AnalyticsProvider({ directory: 'data' });

analyticsProvider.update(slug)

Updates the view count for a given document slug.

Kind: instance method of AnalyticsProvider

ParamTypeDescription
slugstringThe slug ofthe document to be updated.

Example

analyticsProvider.update('faq');

analyticsProvider.get(slug) ⇒ Number

Returns the view count for a given document slug.

Kind: instance method of AnalyticsProvider
Returns: Number - View count for the given slug.

ParamTypeDescription
slugstringThe slug of the document to be looked up.

Example

analyticsProvider.get('faq');
➜ 10

analyticsProvider.getPopularDocuments(limit) ⇒ Array

Returns the most popular documents.

Kind: instance method of AnalyticsProvider
Returns: Array - View count for the given slug.

ParamTypeDescription
limitlimitThe number of documents to return.

Example

analyticsProvider.getPopularDocuments(10);
➜ [ { 'faq': 10 } ]

Tests

To run the test suite, first install the dependencies, then run npm test:

npm install
npm test
DEBUG=Uttori* npm test

Contributors

License

Keywords

FAQs

Package last updated on 03 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc