npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

marku

v2.1.1

Published

A lightweight JavaScript library for website analytics, including page view counters and comment systems

Readme

Marku

A lightweight JavaScript library for website analytics, including page view counters and comment systems.

Features

  • 📊 Page View Counters: Track and display page view statistics
  • 💬 Comment System: Collect and manage user comments
  • 🚀 Lightweight: Minimal footprint with no external dependencies
  • 📱 Modern: Built with TypeScript and ES modules
  • 🔧 Easy Integration: Simple API for quick setup

Installation

npm install marku

Quick Start

Basic Usage

<!DOCTYPE html>
<html>
<head>
    <title>My Website</title>
</head>
<body>
    <!-- Page view counter -->
    <p>Views: <span marku-get-count="page-view">0</span></p>
    <button marku-set-count="page-view" marku-inc="1">+1</button>

    <!-- Comment form -->
    <form marku-comment-form="article-1">
        <input type="text" marku-comment-username placeholder="Name" required>
        <input type="email" marku-comment-email placeholder="Email" required>
        <textarea marku-comment-content placeholder="Comment" required></textarea>
        <button type="button" marku-comment-submit>Submit</button>
    </form>

    <script src="https://unpkg.com/marku@latest/dist/marku.umd.js"></script>
    <script>
        const marku = new Marku({
            siteId: 'your-site-id',
            apiBaseUrl: 'https://your-api-server.com'
        });
        marku.init();
    </script>
</body>
</html>

ES Modules

import Marku from 'marku';

const marku = new Marku({
    siteId: 'your-site-id',
    apiBaseUrl: 'https://your-api-server.com'
});

marku.init();

// Listen for events
document.addEventListener('marku:comment-success', (e) => {
    console.log('Comment submitted:', e.detail);
});

document.addEventListener('marku:comment-error', (e) => {
    console.error('Comment failed:', e.detail);
});

Configuration

const config = {
    siteId: 'your-site-id',        // Required: Unique identifier for your site
    apiBaseUrl: 'https://api.com', // Required: Your API server URL
    debug: false                   // Optional: Enable debug logging
};

const marku = new Marku(config);

API Reference

Constructor

new Marku(config)

Methods

  • init(config?): Initialize Marku with optional config override
  • reload(): Reload and reprocess all elements
  • isInitialized(): Check if Marku is initialized

HTML Attributes

Counter Attributes

  • marku-get-count="key": Display counter value
  • marku-set-count="key": Set counter (use with marku-inc)
  • marku-inc="number": Increment amount for set counter

Comment Attributes

  • marku-comment-form="article-id": Comment form container
  • marku-comment-username: Username input field
  • marku-comment-email: Email input field
  • marku-comment-url: Website URL input field (optional)
  • marku-comment-content: Comment content textarea
  • marku-comment-submit: Submit button

Events

  • marku:comment-success: Fired when comment is successfully submitted
  • marku:comment-error: Fired when comment submission fails

TypeScript Support

Marku is written in TypeScript and includes full type definitions:

import Marku, { MarkuConfig, CommentData } from 'marku';

const config: MarkuConfig = {
    siteId: 'my-site',
    apiBaseUrl: 'https://api.example.com'
};

const marku = new Marku(config);

Browser Support

  • Chrome 63+
  • Firefox 67+
  • Safari 13.1+
  • Edge 79+

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues, please open an issue on GitHub.