Commit 585c85b
authored
Test out fetch-with-keepalive on plausible.io (#5005)
* Test out fetch-with-keepalive on plausible.io
Fetch with keepalive is a
[widely-supported](https://developer.mozilla.org/en-US/docs/Web/API/Request/keepalive)
which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.
We're hoping it will improve event capture rates for `pageleave` and
`pageview` events when the user closes the tab
To use it, we also need to start using `fetch` (with fallback to xhr).
For extra safety, we will only deploy this on `plausible.io` initially.
This will ensure that if there are issues we will be able to react
without affecting any other customers.
TODO after this PR:
- [ ] Companion docs PR
- [ ] Purge bunny cache
- [ ] Make fetch the default request method without data-property
* Mark some code conditional1 parent 4f98259 commit 585c85b
File tree
2 files changed
+24
-0
lines changed- lib/plausible_web/templates/layout
- tracker/src
2 files changed
+24
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
224 | 246 | | |
225 | 247 | | |
226 | 248 | | |
| |||
232 | 254 | | |
233 | 255 | | |
234 | 256 | | |
| 257 | + | |
235 | 258 | | |
236 | 259 | | |
237 | 260 | | |
| |||
0 commit comments