Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/authors.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Our team
---

Expand Down
1 change: 1 addition & 0 deletions docs/buttondown.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add the script to Buttondown
---

Expand Down
1 change: 1 addition & 0 deletions docs/carrd-integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Adding Plausible to Carrd (and tracking custom events)
---

Expand Down
1 change: 1 addition & 0 deletions docs/community-integrations.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Community integrations
---

Expand Down
1 change: 1 addition & 0 deletions docs/contribute.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to contribute
---

Expand Down
1 change: 1 addition & 0 deletions docs/custom-automatic-link-tracking.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Tracking clicks on cloaked affiliate links and other pretty URLs
---

Expand Down
1 change: 1 addition & 0 deletions docs/custom-domain.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Serve the script from your domain as a first-party connection
---

Expand Down
1 change: 1 addition & 0 deletions docs/custom-locations.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Specify a custom location to aggregate pages that contain identifiers
---

Expand Down
1 change: 1 addition & 0 deletions docs/custom-pageview-props.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Custom properties for pageviews
---

Expand Down
1 change: 1 addition & 0 deletions docs/custom-query-params.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Tracking custom query parameters
---

Expand Down
1 change: 1 addition & 0 deletions docs/data-pipelines.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Viewing Plausible stats elsewhere
---

Expand Down
1 change: 1 addition & 0 deletions docs/discourse-integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add the script to your Discourse community
---

Expand Down
1 change: 1 addition & 0 deletions docs/docusaurus-integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add the script to your Docusaurus site
---

Expand Down
1 change: 1 addition & 0 deletions docs/excluding-localstorage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Opt out and exclude your visits from the analytics by setting a localStorage flag in your browser
---

Expand Down
1 change: 1 addition & 0 deletions docs/excluding-pages.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Exclude specific pages from being tracked
---

Expand Down
1 change: 1 addition & 0 deletions docs/get-started-with-postman.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to get started with the Stats API using Postman
---

Expand Down
1 change: 1 addition & 0 deletions docs/ghost-integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add the script to your Ghost site
---

Expand Down
1 change: 1 addition & 0 deletions docs/google-tag-manager.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add the script to your site using Google Tag Manager
---

Expand Down
1 change: 1 addition & 0 deletions docs/hash-based-routing.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Hashed page paths
---

Expand Down
1 change: 1 addition & 0 deletions docs/hubspot-analytics.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add Plausible Analytics to your HubSpot site
---

Expand Down
1 change: 1 addition & 0 deletions docs/hugo-integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add the script to your Hugo site
---

Expand Down
1 change: 1 addition & 0 deletions docs/internal-link-click-tracking.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Internal link click tracking
---

Expand Down
1 change: 1 addition & 0 deletions docs/javascript-snippet.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Where do I find my JavaScript snippet?
---

Expand Down
1 change: 1 addition & 0 deletions docs/manual-link-tagging.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Paid campaigns, UTM tags and conversion attribution
---

Expand Down
1 change: 1 addition & 0 deletions docs/mediawiki-integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add Plausible to your MediaWiki instance
---

Expand Down
5 changes: 3 additions & 2 deletions docs/nextjs-integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to add the script to your NextJS site
---

Expand All @@ -10,7 +11,7 @@ You can add the script directly to your head through "next/head" or react-helmet

## Serving the Plausible script

```jsx
```jsx title="pages/index.jsx"
import PlausibleProvider from 'next-plausible'

export default Home() {
Expand All @@ -25,7 +26,7 @@ export default Home() {

## Sending custom events

```jsx
```jsx title="components/PlausibleButton.jsx"
import {usePlausible} from 'next-plausible'

export default PlausibleButton() {
Expand Down
1 change: 1 addition & 0 deletions docs/plausible-analytics-reviews.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Plausible Analytics reviews and in media
---

Expand Down
1 change: 1 addition & 0 deletions docs/plausible-analytics-self-hosted-guides.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Plausible Community Edition (CE)
---

Expand Down
1 change: 1 addition & 0 deletions docs/proxy/guides/akamai.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Proxying Plausible through Akamai
---

Expand Down
4 changes: 2 additions & 2 deletions docs/proxy/guides/apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Our managed proxy lets you send analytics through your own domain name as a firs

## Step 1: Enable the required modules

```
```bash
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod ssl
Expand All @@ -32,7 +32,7 @@ the snippet specific for your site. It will look similar to the following:
Your snippet will have a different script location than the example above. Look for the `https://plausible.io/js/pa-XXXXX.js` part in your snippet - that's the personalized location for your site's script. Mark it down for subsequent steps.

## Step 3: Update your config
```
``` title="apache-vhost.conf"
<VirtualHost *:80>
ServerName website.com

Expand Down
2 changes: 1 addition & 1 deletion docs/proxy/guides/caddy.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Your snippet will have a different script location than the example above. Look

Add the following to your Caddyfile:

```
``` title="Caddyfile"
@plausible path /js/script.js /api/event
handle @plausible {
# Use path from step 1
Expand Down
12 changes: 8 additions & 4 deletions docs/proxy/guides/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In your Cloudflare account, click on the "Compute (Workers" > 'Workers & Pages'

## Step 2 (Optional): You can change your service name

This is optional but you can change the service name to give your worker a more meaningful name. Do avoid words like 'plausible', 'analytics', 'tracking', 'stats', etc. as they may be blocked. It's also fine to keep the random name that Cloudflare generates by default. Then click on the 'Deploy' button.
This is optional but you can change the service name to give your worker a more meaningful name. It's also fine to keep the random name that Cloudflare generates by default. Then click on the 'Deploy' button.

<img alt="Deploy CloudFlare worker" src={useBaseUrl('img/deploy-cloudflare-worker.png')} />

Expand All @@ -46,17 +46,21 @@ Next click on the 'Edit Code' button, remove the default code that Cloudflare pr

<img alt="Edit CloudFlare worker" src={useBaseUrl('img/edit-worker-code.png')} />

We recommend you change the folder name in the first two lines in the code below. This makes your proxy more difficult to discover and block. We especially recommend you change the folder name in the two lines if you're not hosting your site on the Cloudflare CDN.
:::tip
Change the folder name in the first two lines of the code below. This makes your proxy harder to discover and block, especially if you're not hosting your site on the Cloudflare CDN.
:::

In the **ProxyScript** line, change `https://plausible.io/js/pa-XXXXX.js` to your script location from step 3.

In the **ScriptName** line, change the `/js/` to whatever you wish. Say `/your-folder-name/`. Then the location in the code would be `/your-folder-name/script.js`.

In the **Endpoint** line, change the `/api/` to whatever you want. It can be the same as above but you can also choose something different. If you choose `/your-folder-name/`, then the full location would be `/your-folder-name/event`.

Do avoid words like 'plausible', 'analytics', 'tracking', 'stats', etc. as they may be blocked.
:::warning
Avoid words like 'plausible', 'analytics', 'tracking', 'stats' in path names as they may be blocked.
:::

```js
```js title="cloudflare-worker.js"
const ProxyScript = 'https://plausible.io/js/pa-XXXXX.js'
const ScriptName = '/js/script.js';
const Endpoint = '/api/event';
Expand Down
1 change: 1 addition & 0 deletions docs/proxy/guides/cloudfront.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Proxying Plausible through CloudFront
---

Expand Down
1 change: 1 addition & 0 deletions docs/proxy/guides/deno.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Proxying Plausible through Deno Deploy
---

Expand Down
1 change: 1 addition & 0 deletions docs/proxy/guides/fastly.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Proxying Plausible through Fastly
---

Expand Down
1 change: 1 addition & 0 deletions docs/proxy/guides/fresh.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Proxying Plausible through Fresh
---

Expand Down
18 changes: 10 additions & 8 deletions docs/proxy/guides/laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ php artisan make:controller PlausibleProxyController

Add the following code to the controller, replacing `https://plausible.io/js/pa-XXXXX.js` with the script location from Step 1.

```php
```php title="app/Http/Controllers/PlausibleProxyController.php"
<?php

namespace App\Http\Controllers;
Expand Down Expand Up @@ -74,25 +74,27 @@ class PlausibleProxyController extends Controller

Add the following routes to your `routes/web.php` file:

```php
```php title="routes/web.php"
use App\Http\Controllers\PlausibleProxyController;

Route::get('/js/script.js', [PlausibleProxyController::class, 'script'])->name('plausible.script');
Route::post('/api/event', [PlausibleProxyController::class, 'event'])->name('plausible.event');
```

Note that:

- You can use whatever paths you like here. Do choose generic names. If you choose something like `analytics`, `stats` or `plausible`, it may get blocked.
:::warning
Use generic path names. Paths like `/analytics`, `/stats` or `/plausible` may get blocked by adblockers.
:::


## Step 4: Exempt the event route from CSRF

The Plausible script sends POST requests to the event endpoint, which Laravel's CSRF protection will block by default.
:::warning
Laravel's CSRF protection will block POST requests to the event endpoint by default. This step is required for tracking to work.
:::

In your `bootstrap/app.php` file, add the event route to the CSRF exceptions:

```php
```php title="bootstrap/app.php"
->withMiddleware(function (Middleware $middleware) {
$middleware->validateCsrfTokens(except: [
'api/event', // Add this line
Expand All @@ -104,7 +106,7 @@ In your `bootstrap/app.php` file, add the event route to the CSRF exceptions:

Add the script tags to your application's HTML `<head>`, configuring the `src` and `endpoint` to match the named route from Step 3:

```blade
```blade title="layout.blade.php"
<script async src="{{ route('plausible.script') }}"></script>
<script>
window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
Expand Down
12 changes: 9 additions & 3 deletions docs/proxy/guides/netlify.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ Replace `https://plausible.io/js/pa-XXXXX.js` with script location from step 1.
Note that:

- The source paths identified here **must be** used when configuring the HTML script tag in the next section.
- You can use whatever paths you like here (for example, here prefixing with `/your-subdirectory/`). Do choose a generic or irrelevant name. If you choose something like analytics, stats or plausible, it might get blocked.
- You can use whatever paths you like here (for example, here prefixing with `/your-subdirectory/`).

:::warning
Avoid names like `analytics`, `stats` or `plausible` in your paths as they may get blocked.
:::

## Step 3: Update your snippet

Expand All @@ -59,6 +63,8 @@ Deploy these changes to your Netlify site. You can verify the proxy is working b

## Troubleshooting

If your `<script>` tag's `src` attribute is being manipulated to some unrecognised CDN URL, it's because you have the `Asset optimization` JS settings enabled in Netlify. Both the `Bundle JS` and `Minify JS` options must be de-selected to avoid interference with the proxied Plausible URL.
:::warning
If your `<script>` tag's `src` attribute is being rewritten to an unrecognised CDN URL, you have `Asset optimization` JS settings enabled in Netlify. Both the `Bundle JS` and `Minify JS` options must be de-selected to avoid interference with the proxied Plausible URL.
:::

Prefer not to disable the `Asset optimization`? Try to use the absolute URL in the `src` attribute of your `<script>` (`https://yourdomain.com/your-subdirectory/js/script.js`).
Prefer not to disable `Asset optimization`? Use the absolute URL in the `src` attribute instead: `https://yourdomain.com/your-subdirectory/js/script.js`.
1 change: 1 addition & 0 deletions docs/proxy/guides/nextjs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: Proxying Plausible with Next.js
---

Expand Down
2 changes: 1 addition & 1 deletion docs/proxy/guides/nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Your snippet will have a different script location than the example above. Look

## Step 2: Update your Nginx config

```
```nginx title="nginx.conf"
# Only needed if you cache the plausible script. Speeds things up.
#
# Note: to use the `proxy_cache` setup, you'll need to make sure the `/var/run/nginx-cache`
Expand Down
8 changes: 6 additions & 2 deletions docs/proxy/guides/vercel.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Add a special `vercel.json` file in your application root:

Add the following JSON to rewrite calls within your application to Plausible's resources:

```json
```json title="vercel.json"
{
"rewrites": [
{
Expand All @@ -57,7 +57,11 @@ Replace `https://plausible.io/js/pa-XXXXX.js` with script location from step 1.
Note that:

- The source paths identified here **must be** used when configuring the HTML script tag in the next section.
- You can use whatever paths you like here (for example, here prefixing with `/your-subdirectory/`). Do choose a generic or irrelevant name. If you choose something like analytics, stats or plausible, it might get blocked.
- You can use whatever paths you like here (for example, here prefixing with `/your-subdirectory/`).

:::warning
Avoid names like `analytics`, `stats` or `plausible` in your paths as they may get blocked.
:::

## Step 4: Update your snippet

Expand Down
1 change: 1 addition & 0 deletions docs/script-extensions-for-wp-plugin.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
displayed_sidebar: someSidebar
title: How to use script extensions with the WordPress plugin
---

Expand Down
Loading
Loading