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 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-plausible-analytics

v0.3.0

Published

Integrate your Hexo blog with Plausible Analytics

Downloads

146

Readme

hexo-plausible-analytics

A simple Hexo plugin to inject Plausible Analytics script in your pages.

General

Compatibility: Hexo 3 and above

Features

  • Extremely simple configuration
  • Supports custom domain
  • Supports exclude directive
  • Supports self-hosting
  • Inject the script only on specific page types (page, post, draft, archive, ...)

Install

In the root directory of your project run:

$ npm install hexo-plausible-analytics

Configurations

Enable the plugin

To enable the plugin add this to your config.yml:

plausible:
  enable: true
  domain: YOUR_DOMAIN

domain is the domain name of your site and is the only required property. Be sure to remove https and www from the URL. If your site is https://www.yourdomain.com then your configuration should look like this:

plausible:
  enable: true
  domain: yourdomain.com

Will result in:

<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.js"></script>

Specify page types

The pages property is an array that allows you to specify on which page types to inject the script. Valid values are:

  • default: Inject to every page. This is the default configuration.
  • home: Only inject to home page (which has is_home() helper being true)
  • post: Only inject to post pages (which has is_post() helper being true)
  • page: Only inject to pages (which has is_page() helper being true)
  • archive: Only inject to archive pages (which has is_archive() helper being true)
  • category: Only inject to category pages (which has is_category() helper being true)
  • tag: Only inject to tag pages (which has is_tag() helper being true)

The following configuration will inject the scripts only on the home page and all posts:

plausible:
  enable: true
  domain: yourdomain.com
  pages:
    - home
    - post

Serve as first-party connection

Add the subdomain property and specify your subdomain if you want to serve the Plausible script as a first-party connection.

plausible:
  enable: true
  domain: yourdomain.com
  subdomain: stats

Will result in:

<script async defer data-domain="yourdomain.com" src="https://stats.yourdomain.com/js/index.js"></script>

Exclude pages from being tracked

Specify in the exclude property the pages that you don't want to be tracked. You can enter them as a comma-separated string or as an array. Check the official guide on how to format them.

plausible:
  enable: true
  domain: yourdomain.com
  exclude: '/blog4, /rule/*, /how-to-*, /*/admin'

Or as an array:

plausible:
  enable: true
  domain: yourdomain.com
  exclude: 
    - /blog4
    - /rule/*
    - /how-to-*
    - /*/admin'

Both these configurations will result in:

<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.exclusions.js" data-exclude="/blog4, /rule/*, /how-to-*, /*/admin"></script>

The exclude property also works if you configured a subdomain:

plausible:
  enable: true
  domain: yourdomain.com
  subdomain: stats
  exclude: '/blog4, /rule/*, /how-to-*, /*/admin'

Will result in:

<script async defer data-domain="yourdomain.com" src="https://stats.yourdomain.com/js/index.exclusions.js" data-exclude="/blog4, /rule/*, /how-to-*, /*/admin"></script>

Self-hosting

In case you are self hosting you can specify the src property:

plausible:
  enable: true
  domain: yourdomain.com
  src: https://yourdomain.com/plausible.js

Will result in:

<script async defer data-domain="yourdomain.com" src="https://yourdomain.com/plausible.js"></script>

In case set the exclude property:

plausible:
  enable: true
  domain: yourdomain.com
  src: https://yourdomain.com/plausible.js
  exclude: '/blog4, /rule/*, /how-to-*, /*/admin'

Will result in:

<script async defer data-domain="yourdomain.com" src="https://yourdomain.com/plausible.js" data-exclude="/blog4, /rule/*, /how-to-*, /*/admin"></script>

Contributing

I work on the develop branch and release from the main. If you want to contribute fork this repository and create a new branch from develop. Once you are done open a Pull Request to develop.