Skip to content

Commit d2e35e8

Browse files
committed
Deprecate some guides
1 parent d890bed commit d2e35e8

File tree

7 files changed

+8
-460
lines changed

7 files changed

+8
-460
lines changed

docs/proxy/guides/akamai.md

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2,94 +2,8 @@
22
title: Proxying Plausible through Akamai
33
---
44

5-
import useBaseUrl from '@docusaurus/useBaseUrl';
6-
7-
Here's how to proxy Plausible through your own property on Akamai. The instructions assume you use the default paths ``/js/script.js`` and ``/api/event``. You can change these based on your preferences.
5+
We've removed old proxying instructions due to being out of date. [See our general proxying guide](/proxy/introduction).
86

97
:::tip Don't want to manage your own proxy? We can handle it for you
108
Our managed proxy lets you send analytics through your own domain name as a first-party connection. All you need to do is set up a CNAME record using the instructions we'll send you and update the snippet on your site. We'll take care of everything else. [Contact us for details](https://plausible.io/contact).
119
:::
12-
13-
## Step 1: Proxy Analytics Script
14-
15-
This Rule Group serves incoming requests matching ``/js/script.js`` directly from the Akamai edge caches. In case of a cache miss the request is forwarded to ``plausible.io`` in a privacy-friendly way.
16-
17-
### Add new Rule Group
18-
19-
In Akamai Property Manager add a new Rule Group ``Plausible (Script)`` with these settings:
20-
21-
<img alt="In Akamai Property Manager add a new Rule Group" src={useBaseUrl('img/akamai-script-pm.jpg')} />
22-
23-
### Set Criteria
24-
25-
- Path matches one off: ``/js/script.js``
26-
27-
### Add Behaviour: Caching
28-
29-
- Caching Option: **Cache**
30-
- Force revalidation of stale objects: **Serve stale if unable to validate**
31-
- Maxage: ``6 hours``
32-
33-
### Add Behaviour: Origin Server
34-
35-
- Origin Type: **Your origin**
36-
- Origin Server Hostname: ``plausible.io``
37-
- Forward Host Header: **Origin Hostname**
38-
- Cache Key Hostname: **Origin Hostname**
39-
- Supports Gzip Compression: **Yes**
40-
- Send True Client IP Header: **No** _(Privacy: No need to expose IP)_
41-
- Verification Settings: **Choose your own**
42-
- ... _(Other settings can be left as is)_
43-
44-
## Step 2: Proxy Event API
45-
46-
This Rule Group forwards incoming requests matching ``/api/event`` to plausible.io. It adds extra headers (``X-Forwarded-Proto``, ``X-Forwarded-Host`` and ``X-Forwarded-For``) to the outgoing request, so your Plausible statistics are complete. For privacy & security reasons incoming cookies are removed before sending to ``plausible.io``.
47-
48-
### Add new Rule Group
49-
50-
In Akamai Property Manager add a new Rule Group ``Plausible (Event API)`` with these settings:
51-
52-
<img alt="Property Manager Rule to proxy the Event API" src={useBaseUrl('img/akamai-api-pm.jpg')} />
53-
54-
### Set Criteria
55-
56-
- Path matches one off: ``/api/event``
57-
58-
### Add Behaviour: Origin Server
59-
60-
- Origin Type: **Your origin**
61-
- Origin Server Hostname: ``plausible.io``
62-
- Forward Host Header: **Origin Hostname**
63-
- Cache Key Hostname: **Origin Hostname**
64-
- Supports Gzip Compression: **Yes**
65-
- Send True Client IP Header: **Yes**
66-
- True Client IP Header Name: ``X-Forwarded-For``
67-
- Verification Settings: **Choose your own**
68-
- ... _(Other settings can be left as is)_
69-
70-
<img alt="Property Manager Rules to remove outgoing request headers and cookies" src={useBaseUrl('img/akamai-api-pm-headers.jpg')} />
71-
72-
### Add Behaviour: Modify Outgoing Request Header
73-
74-
- Action: **Add**
75-
- Header Name: ``X-Forwarded-Proto``
76-
- Header Value: ``{{builtin.AK_SCHEME}}``
77-
78-
### Add Behaviour: Modify Outgoing Request Header
79-
80-
- Action: **Add**
81-
- Header Name: ``X-Forwarded-Host``
82-
- Header Value: ``{{builtin.AK_HOST}}``
83-
84-
### Add Behaviour: Modify Outgoing Request Header
85-
86-
- Action: **Remove**
87-
- Header Name: ``cookie`` _(Privacy: No need to expose cookies to origin servers)_
88-
89-
### Optional:
90-
91-
In case you are using SureRoute, please disable it:
92-
93-
<img alt="In case you are using SureRoute, please disable it" src={useBaseUrl('img/akamai-script-sureroute.jpg')} />
94-
95-
Thanks to [Tim Vereecke](https://www.scalemates.com/), Akamai's web performance architect, for these instructions!

docs/proxy/guides/cloudfront.md

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,8 @@
22
title: Proxying Plausible through CloudFront
33
---
44

5-
import useBaseUrl from '@docusaurus/useBaseUrl';
6-
7-
You can use CloudFront to proxy your Plausible Analytics requests. Here's the step-by-step process for creating a proxy.
5+
We've removed old proxying instructions due to being out of date. [See our general proxying guide](/proxy/introduction).
86

97
:::tip Don't want to manage your own proxy? We can handle it for you
108
Our managed proxy lets you send analytics through your own domain name as a first-party connection. All you need to do is set up a CNAME record using the instructions we'll send you and update the snippet on your site. We'll take care of everything else. [Contact us for details](https://plausible.io/contact).
119
:::
12-
13-
Step 0: Sign up for a free AWS account if you don't have an account already and create a CloudFront distribution.
14-
15-
## Step 1: Create new origin
16-
17-
You need to create a new origin pointing to the Plausible server. In the CloudFront console, under your distribution, create a new origin by going into the "**Origins**" section and clicking on "**Create origin**".
18-
19-
1. Set "**Origin domain**" to: `plausible.io`
20-
2. Set the "**Protocol**" policy to: `HTTPS Only`
21-
3. You do not need to change any of the other options on this screen
22-
4. Click on the "**Create origin**" button
23-
24-
## Step 2: Create behaviors
25-
26-
Now you need to define two behaviors for when to use the new origin. In the CloudFront console, under your distribution, create a new behavior by going into the "**Behavior**" section and clicking on "**Create behavior**".
27-
28-
Create a behavior for the analytics script:
29-
30-
1. Set the "**Path pattern**" to: `/js/script.js` (you can also use `/js/script.*` to match [script extensions](https://plausible.io/docs/script-extensions))
31-
2. In "**Origin and origin groups**", choose the origin that you created in step 1
32-
3. Set "**Compress objects automatically**" to: `No`
33-
4. Set the "**Viewer protocol policy**" to: `HTTPS Only`
34-
5. Set the "**Allowed HTTP methods**" to: `GET, HEAD`
35-
6. In "**Cache key and origin requests**", choose "**Legacy cache settings**"
36-
7. You do not need to change any of the other options on this screen
37-
8. Click on the "**Create behavior**" button
38-
39-
And create a behavior for the event API:
40-
41-
1. Set the "**Path pattern**" to: `/api/event`
42-
2. In "**Origin and origin groups**", choose the origin that you created in step 1
43-
3. Set "**Compress objects automatically**" to: `No`
44-
4. Set the "**Viewer protocol policy**" to: `HTTPS Only`
45-
5. Set the "**Allowed HTTP methods**" to: `GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE`
46-
6. In "**Cache key and origin requests**", use the "**Cache policy and origin request policy**"
47-
7. Set the "**Cache policy**" to: `CachingDisabled`
48-
8. Set the "**Origin request policy**" to: `UserAgentRefererHeaders`
49-
9. Set the "**Response headers policy**" to: `SimpleCORS`
50-
10. You do not need to change any of the other options on this screen
51-
11. Click on the "**Create behavior**" button
52-
53-
## Step 3: Integrate a new snippet into your site header
54-
55-
With the origin and behaviours in place, you can replace your Plausible Analytics script tag in the Header (`<head>`) section of your site with the proxied snippet. This is how the new snippet should look like (make sure to edit it to have the correct domain name of your site):
56-
57-
```html
58-
<script defer data-domain="yourdomain.com" src="/js/script.js"></script>
59-
```
60-
61-
If you're not using the CloudFront with a custom domain, you'll also need to add a `data-api` attribute to tell the script where the data should be sent. This is how the new snippet should look like in that case (do make sure to edit it to the correct URL of your CloudFront distribution)
62-
63-
```html
64-
<script defer data-domain="yourdomain.com" data-api="https://YOURDISTRIBUTION.cloudfront.net/api/event" src="https://YOURDISTRIBUTION.cloudfront.net/js/script.js"></script>
65-
```
66-
67-
Using our extensions such as hash-based routing, revenue or outbound link click tracking? Change the file name from `script.js` to the script you want to use: `script.hash.js`, `script.revenue.js` or `script.outbound-links.js`. Want to use more than one extension? You can chain them like this: `script.hash.revenue.outbound-links.js`.
68-
69-
Deploy these changes to your site. You can verify the proxy is working by opening your network tab. You should see a request to
70-
`https://yourdomain.com/js/script.js` with status 200 and another one to `https://yourdomain.com/api/event` with status 202.
71-
72-
That's it! You're now counting your website stats using a proxy.
73-
74-
Thanks to [@thomasjsn](https://github.com/thomasjsn) for contributing these instructions!

docs/proxy/guides/deno.md

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,85 +2,8 @@
22
title: Proxying Plausible through Deno Deploy
33
---
44

5+
We've removed old proxying instructions due to being out of date. [See our general proxying guide](/proxy/introduction).
6+
57
:::tip Don't want to manage your own proxy? We can handle it for you
68
Our managed proxy lets you send analytics through your own domain name as a first-party connection. All you need to do is set up a CNAME record using the instructions we'll send you and update the snippet on your site. We'll take care of everything else. [Contact us for details](https://plausible.io/contact).
79
:::
8-
9-
## Step 1: Deploy proxy code
10-
11-
Start by getting a [Deno Deploy](https://deno.com/deploy) account if you don't have one already.
12-
13-
There's a few ways to get code deployed on Deno Deploy. We'll cover two in this section:
14-
15-
- Using Deno Deploy's web interface.
16-
- Using Deno's runtime CLI.
17-
18-
In both cases, the <span id="proxy-script" style={{scrollMarginTop: "70px"}}>script</span> that you'll need to deploy will look something like this:
19-
20-
```typescript
21-
const SCRIPT_PATH = "/pap/script.js"
22-
const EVENT_PATH = "/pap/event"
23-
24-
Deno.serve((request, info) => {
25-
if (request.url.endsWith(SCRIPT_PATH)) {
26-
return fetch("https://plausible.io/js/plausible.js")
27-
} else if (request.url.endsWith(EVENT_PATH)) {
28-
const requestClone = new Request(request)
29-
requestClone.headers.delete("Cookie")
30-
requestClone.headers.set("X-Forwarded-For", info.remoteAddr.hostname)
31-
return fetch("https://plausible.io/api/event", requestClone)
32-
}
33-
return new Response(null, { status: 404 })
34-
})
35-
```
36-
37-
Notice that we remove the `Cookie` header as that could contain sensitive information that's best not shared. We also set the value of `X-Forwarded-For` with the user's IP. See the [events API](../../events-api#request-headers) page for more information on header requirements.
38-
39-
Both `SCRIPT_PATH` and `EVENT_PATH` can and should be customised. They should match the paths you'll end up using in the `script` tag you'll add to the site you want analytics on.
40-
41-
### Using Deno Deploy's web interface
42-
43-
Log into Deno Deploy, navigate to the [Projects Overview](https://dash.deno.com/account/projects) page and click on the "New Playground" button:
44-
45-
![Screenshot of Deno Deploy Projects Overview page](/img/proxy-deno-new-playground.png)
46-
47-
This will deploy a new project and present an online text editor with the contents of your project's `main.ts` file. Paste the contents of the [proxy script](#proxy-script) provided above and click on "Save & Deploy":
48-
49-
![Screenshot of Deno Deploy's playground page](/img/proxy-deno-save-and-deploy.png)
50-
51-
### Using Deno's runtime CLI
52-
53-
Assuming you have a local installation of the [Deno runtime](https://docs.deno.com/runtime/manual#install-deno), initialize a new project with the init command:
54-
55-
```shell
56-
deno init proxy-project-folder
57-
```
58-
59-
Inside that folder, create a file named `main.ts` with the contents of the [proxy script](#proxy-script) provided above.
60-
61-
To deploy your proxy script, run the following from the project folder:
62-
63-
```shell
64-
deno deploy
65-
```
66-
67-
## Step 2: Add script tag to site
68-
69-
After successful deployment, your proxy script will be served from a custom `deno.dev` subdomain. You can confirm that it's working by visiting the URL for the Plausible client-side script:
70-
71-
```
72-
https://your-deno-subdomain.deno.dev/pap/script.js
73-
```
74-
75-
If that works, you can go ahead and add the following [script tag](plausible-script.md) to the site you want analytics on:
76-
77-
```html
78-
<script
79-
defer
80-
src="https://your-deno-subdomain.deno.dev/pap/script.js"
81-
data-api="https://your-deno-subdomain.deno.dev/pap/event"
82-
data-domain="your-domain.com"
83-
></script>
84-
```
85-
86-
Your single proxy will work with multiple sites; you'll just need to update the `data-domain` attribute for each new site.

docs/proxy/guides/fastly.md

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,89 +2,8 @@
22
title: Proxying Plausible through Fastly
33
---
44

5-
import useBaseUrl from '@docusaurus/useBaseUrl';
6-
7-
You can use Fastly to proxy your Plausible Analytics requests. Here's the step-by-step process for creating a proxy.
5+
We've removed old proxying instructions due to being out of date. [See our general proxying guide](/proxy/introduction).
86

97
:::tip Don't want to manage your own proxy? We can handle it for you
108
Our managed proxy lets you send analytics through your own domain name as a first-party connection. All you need to do is set up a CNAME record using the instructions we'll send you and update the snippet on your site. We'll take care of everything else. [Contact us for details](https://plausible.io/contact).
119
:::
12-
13-
## Step 1: Create the Backend for Plausible
14-
15-
First, set up a Plausible backend:
16-
17-
1. Go to your Fastly service configuration
18-
2. Click on "**Origins**" or "**Hosts**"
19-
3. Click "**Create a host**"
20-
4. Fill in:
21-
22-
* Name: `Plausible`
23-
* Address: `plausible.io`
24-
* Port: `443`
25-
* Enable SSL: `Checked`
26-
* Verify certificate: `Checked`
27-
* SNI hostname: `plausible.io`
28-
29-
5. Set the timeouts:
30-
31-
* First byte timeout: `15000` (15 seconds)
32-
* Between bytes timeout: `10000` (10 seconds)
33-
34-
6. Save
35-
36-
## Step 2: Create VCL Snippet
37-
38-
Snippet 1: Plausible Request Routing (`vcl_recv`)
39-
40-
1. Go to "**VCL Snippets**"
41-
2. Click "**Create snippet**"
42-
3. Fill in:
43-
44-
* Name: `Plausible Request Routing`
45-
* Type: `recv (vcl_recv)`
46-
* Priority: `100` (or any number that ensures this runs before your other recv snippets)
47-
48-
4. Add this VCL (Varnish Configuration Language):
49-
50-
```
51-
vcl
52-
53-
if (req.url ~ "^/plsbl/.*") {
54-
55-
# Remove our prefix for the backend request
56-
set req.url = regsub(req.url, "^/plsbl", "");
57-
58-
# Set the backend to Plausible
59-
set req.backend = F_Plausible;
60-
61-
# Set host header to plausible.io
62-
set req.http.host = "plausible.io";
63-
64-
return(pass);
65-
}
66-
```
67-
68-
5. Save
69-
70-
## Step 3: Integrate a new snippet into your site header
71-
72-
You can now replace your Plausible Analytics script tag in the Header (`<head>`) section of your site with the proxied snippet. This is how the new snippet should look like (make sure to edit it to have the correct domain name of your site):
73-
74-
```html
75-
<script defer data-domain="yourdomain.com" src="/js/script.js"></script>
76-
```
77-
78-
In case of a subdirectory installation, you'll also need to add a `data-api` attribute to tell the script where the data should be sent.
79-
80-
```html
81-
<script defer data-domain="yourdomain.com" data-api="/plsbl/api/event" src="/plsbl/js/script.js"></script>
82-
```
83-
84-
Are you using our extensions such as hash-based routing, revenue or outbound link click tracking? Change the file name from `script.js` to the script you want to use: `script.hash.js`, `script.revenue.js` or `script.outbound-links.js`. Want to use more than one extension? You can chain them like this: `script.hash.revenue.outbound-links.js`.
85-
86-
Deploy these changes to your site. You can verify the proxy is working by opening your network tab. You should see a request to `https://yourdomain.com/js/script.js` with status 200 and another one to `https://yourdomain.com/api/event` with status 202.
87-
88-
That's it! You're now counting your website stats using a proxy.
89-
90-
Thanks to Lynden Jones for creating this guide!

0 commit comments

Comments
 (0)