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

@devular/gatsby-plugin-plausible

v0.1.8

Published

A Gatsby plugin for adding Plausible analytics to your Gatsby site

Downloads

61

Readme

@devular/gatsby-plugin-plausible

This plugin was forked from pixelplicity/gatsby-plugin-plausible to support Plausible's proxying configuration.

npm package

A Gatsby plugin for adding Plausible analytics to your Gatsby site.

The plugin includes the Plausible tracking script. It supports using a custom domain and excluding specific paths from recording page views.


Install

Manual

  1. Install @devular.gatsby-plugin-plausible

    npm install --save @devular/gatsby-plugin-plausible

  2. Add plugin to gatsby-config.js

    // In your gatsby-config.js
    module.exports = {
      plugins: [
        // The only required option is the domain
        {
          resolve: `@devular/gatsby-plugin-plausible`,
          options: {
            domain: `your-site.com`,
            proxyScript: `/sub-directory/script.js`,
            proxyApi: `/sub-directory/api/event`,
          },
        },
      ],
    };

Gatsby Recipe

This will install @devular/gatsby-plugin-plausible and add a sample configuration.

  1. Upgrade gatsby-cli and gatsby to the latest version:

    npm install -g gatsby-cli@latest npm install gatsby@latest

  2. Run the recipe gatsby recipes https://raw.githubusercontent.com/devular/gatsby-plugin-plausible/master/gatsby-recipe-plausible.mdx

  3. Update gatsby-config.js options.

To read more about recipes check out the announcement.

How to use

NOTE: By default, this plugin only generates output when run in production mode. To test your tracking code, run gatsby build && gatsby serve.

Options

| Option | Explanation | | -------------- | ---------------------------------------------------- | | domain | The domain configured in Plausible (required) | | proxyScript | A script location for a proxy configuration | | proxyApi | An collection endpoint for aproxy configurations | | excludePaths | Array of pathnames where page views will not be sent |

_NOTE: You can read more about proxying Plausible here

Pageview events

Pageviews are sent automatically when a user changes routes, including the initial load of your site.

Triggering custom events

To track goals and conversions you have to trigger custom events first.

window.plausible('Signup', {
  callback: () => console.info('Sent Signup event'),
});

The event name can be anything. The second argument is an object with options. The only supported option is callback that is called once the event has been sent.

NOTE: Custom events will not show up right away. You have to configure a goal in your Plausible dashboard.

Changelog

See CHANGELOG.md.

License

MIT | Devular

Forked from: https://github.com/pixelplicity/gatsby-plugin-plausible with MIT