How to exclude your own mobile browser visits from Plausible Analytics

Published on in Bookmarklet

Last updated on

Use a bookmarklet to stop Plausible Analytics from counting your own visits made using mobile devices.

Table of contents

Excluding desktop browsers

TL;DR: Run localStorage.plausible_ignore = true in the browser's console to start excluding your own visits.

More specific instructions in Plausible docs.

Excluding mobile browsers

We need to set the localStorage item mentioned in the previous section.

However, running code in a browser's console on an Android device is a hassle[1]. Running code in iOS Safari's console is also a hassle[2], and only possible if you have a Mac as far as I know.

What doesn't work

You could try pasting the following code to the browser's URL bar and then executing it by "visiting" the URL:

javascript:localStorage.plausible_ignore=true

It's the same code as the code that should be run on desktops, but prefixed with javascript:.

But it doesn't work on my iPad. I don't know about Android devices; you could try.

What does work: a bookmarklet

A bookmark with the location set to a javascript: URL is a bookmarklet. So, create a browser bookmark with the location set to the code from the previous section, and then run it. Here's how:

Note that Firefox for iOS doesn't support bookmarklets.

I confirmed that the bookmarklet worked by looking at my site's analytics; my own visits from my iPad were not counted anymore.

You can make the bookmarklet a bit friendlier by showing an alert box after setting the localStorage item:

javascript:localStorage.plausible_ignore=true&&alert('OK')

Then you don't have to wonder whether the bookmarklet was run or not.

Footnotes

  1. If you want to run code in a browser's console on an Android device, see these articles for pointers:

  2. See How to Debug on iPhone Safari.