Install the script

One script tag, 2,712 bytes, no cookies.

1. Add your site

Sign in, choose "Add site" and type your domain, for example yourdomain.com. Events are only recorded for domains that you have added to your account; events for any other domain are ignored. The script runs in your visitors' browsers, so the endpoint it sends to is public: anyone can send events for a domain that is registered.

2. Paste the snippet

Put this in the <head> of every page you want to count. The dashboard shows the same line with your domain filled in.

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

The defer attribute keeps the script from blocking your page. The script is served from https://guagemint.com, and it sends its events to the same address.

What the script does

  • It sends a pageview event when a page loads, with the page address and the referrer.
  • It sets no cookies and writes nothing to the visitor's browser storage. It only reads one optional opt-out flag and the browser's Do Not Track and Global Privacy Control signals (see below).
  • It sends nothing for a visitor whose browser sends Do Not Track or Global Privacy Control, unless you add data-ignore-dnt to the script tag (see below).
  • It sends one small engagement event, with scroll depth and time on the page, when a visitor leaves a page.
  • Pageviews, custom events and engagement events all count toward your plan's monthly events.

Single-page apps

With the default script, navigation that uses the browser's history (pushState, the back and forward buttons) counts as a new pageview, so React, Vue, Next.js and similar apps need no extra code.

Script variants

Add options to the file name, in any order: /js/script.hash.outbound-links.js. An unknown option returns 404.

OptionWhat it does
hashCounts changes of the page's # part as pageviews, for apps that route with hashes.
manualTurns off automatic pageviews. You call plausible("pageview") yourself.
outbound-linksSends an Outbound Link: Click event, with the link address as a property, when a visitor clicks a link to another site.
file-downloadsSends a File Download event for links to common file types. Set file-types or add-file-types on the script tag to change the list.
tagged-eventsSends events for elements tagged with CSS classes. See Events and goals.
revenueAdds revenue amounts to events. Also works with tagged events.
pageview-propsSends every event-* attribute on the script tag as a property of each pageview.
exclusionsAdds data-include and data-exclude attributes: comma-separated page paths, with * and ** as wildcards, that decide which pages are counted. The rule applies to every event the script would send, including the engagement event and custom events: nothing is sent for an excluded page, so its address never leaves the browser. Each event is checked against the path of the page it is about.
localAlso counts visits from localhost and local files, which are ignored by default. Use it while you test.

What is not counted

  • Visits from localhost and local files, unless you use the local option.
  • Automated browsers such as test runners, and known bot and data-centre traffic.
  • Visitors who opt out. In that visitor's browser, run localStorage.plausible_ignore = "true" once. Nothing else is stored.
  • Visitors whose browser sends Do Not Track or Global Privacy Control. See the next section.

Do Not Track and Global Privacy Control

By default the script sends nothing when the visitor's browser has Do Not Track turned on (navigator.doNotTrack is "1", or the older window.doNotTrack or navigator.msDoNotTrack is "1" or "yes") or sends Global Privacy Control (navigator.globalPrivacyControl is true). That covers pageviews, engagement events and custom events, and nothing is stored to remember the choice.

The trade-off is accuracy: those visitors are missing from your numbers, and some browsers and privacy extensions turn the signal on for everyone, so your counts can be noticeably lower than the real number of visits. If you decide that counting them is right for your site, add data-ignore-dnt to the script tag. The script then counts them like any other visitor. The signal is honoured by default because the script has no way to know what your visitors expect; it is your decision to override it.

<script defer data-ignore-dnt data-domain="yourdomain.com" src="https://guagemint.com/js/script.js"></script>

Plausible's script tag and plausible() function look the same on purpose, so guides written for that style of script will look familiar.

Check that it works

Open your site in a normal browser window, then open the site's dashboard. It shows "waiting for the first event" until the first visit arrives. Ad blockers can block analytics scripts, so test with them off.