gridsome-plugin-plausible-analytics
v1.2.0
Published
Plausible Analytics plugin for Gridsome
Downloads
489
Maintainers
Readme
gridsome-plugin-plausible-analytics
Adds plausible analytics to your gridsome site.
Installation
npm install gridsome-plugin-plausible-analytics
yarn add gridsome-plugin-plausible-analytics
Usage
In gridsome.config.js
:
module.exports = {
plugins: [
{
use: 'gridsome-plugin-plausible-analytics',
options: {
dataDomain: 'blog.example.com',
outboundLinkTracking: false
}
}
]
}
Options
dataDomain
- Type:
String
- Default: None, field is required
Domain you entered on plausible.io e.g. blog.example.com.
excludePages (optional)
- Type:
Array[String]
- Default: None
Do not track visits to the listed pages. Should be an array of strings, each representing a page to ignore. e.g. ["/blog4", "/rule/*", "/how-to-*", "/*/admin", "/*/priv/*", "/more-paths-here"]
For more information, check Excluding Pages on Plausible.
outboundLinkTracking (optional)
- Type:
boolean
- Default:
false
Use Outbound Link Click Tracking. You also need to activate it in your Account. See Step 2 on https://docs.plausible.io/outbound-link-click-tracking#step-2-create-a-custom-event-goal-in-your-plausible-analytics-account.
customDomain (optional)
- Type:
String
- Default: None
Custom domain you set up on plausible.io to serve the js-snippet e.g. stats.[yourdomain].com
(see https://docs.plausible.io/custom-domain)
Development notes
- Testing Plugin
- Create a new Gridsome project (if you don't want to test with an existing one)
- Open a terminal in your plugin project directory
npm link
oryarn link
- Open a terminal in your Gridsome project
npm link my-plugin-name
oryarn link my-plugin-name
gridsome develop
- After testing:
- First in project:
npm unlink --no-save cowabunga
- Second in plugin:
npm unlink
- First in project:
- Source: https://gridsome.org/docs/how-to-create-a-plugin/#testing-your-plugin