2024-07-25 16:33:18 +02:00
|
|
|
---
|
|
|
|
layout: default
|
|
|
|
title: Custom Javascript
|
|
|
|
permalink: /usage/custom_js
|
|
|
|
nav_order: 3
|
|
|
|
parent: Usage
|
|
|
|
---
|
|
|
|
|
|
|
|
## Custom Javascript <span class='label label-yellow'>Since 1.19.0</span> <span class='label label-red'>BETA</span>
|
|
|
|
|
2024-08-21 17:35:13 +02:00
|
|
|
You can integrate some javascript code that will be loaded for each user in `Admin > Theme > Custom JS`
|
2024-07-25 16:33:18 +02:00
|
|
|
|
|
|
|
Don't imagine you can accomplish miracles because the templates are not designed to be easily modified,
|
|
|
|
but don't be afraid to [open an issue](https://framagit.org/les/gancio/-/issues) or even better a PR to add some usage examples to this page.
|
|
|
|
|
|
|
|
|
|
|
|
## Examples:
|
|
|
|
|
2024-10-01 01:42:06 +02:00
|
|
|
### Integrate Plausible ([https://plausible.io/](https://plausible.io/))
|
|
|
|
|
2024-07-25 16:33:18 +02:00
|
|
|
```js
|
|
|
|
var script = document.createElement('script');
|
|
|
|
script.defer = true;
|
|
|
|
script.src = "https://plausible.io/js/script.js";
|
|
|
|
script.dataset.domain = "yourdomain.com";
|
|
|
|
|
|
|
|
document.getElementsByTagName('head')[0].appendChild(script);
|
|
|
|
```
|
2024-10-01 01:42:06 +02:00
|
|
|
### Integrate Umami ([https://umami.is/](https://umami.is/))
|
2024-07-25 16:33:18 +02:00
|
|
|
|
2024-10-01 01:42:06 +02:00
|
|
|
```js
|
2024-10-01 09:23:36 +02:00
|
|
|
var el = document.createElement('script');
|
|
|
|
el.setAttribute('src', 'http://mywebsite.com/umami.js');
|
|
|
|
el.setAttribute('data-website-id', 'your-website-id-string-of-numbers');
|
|
|
|
document.body.appendChild(el);
|
2024-10-01 01:42:06 +02:00
|
|
|
```
|
2024-07-25 16:33:18 +02:00
|
|
|
|
|
|
|
> info "References"
|
2024-10-01 09:27:23 +02:00
|
|
|
> [#413](https://framagit.org/les/gancio/-/issues/413), [#320](https://framagit.org/les/gancio/-/issues/320), [#467](https://framagit.org/les/gancio/-/issues/467)
|
2024-07-25 16:33:18 +02:00
|
|
|
|