diff --git a/README.md b/README.md index 37694ca..0b51b71 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ yarn add astro-matomo | `trackerUrl?` | `string` | Defaults to matomo.php | | `srcUrl?` | `string` | Defaults to matomo.js | | `debug?` | `boolean` | Activate debug mode | +| `partytown?` | `boolean` | Activate [Partytown](https://partytown.builder.io/) | ## Example usage diff --git a/src/index.ts b/src/index.ts index 01f9d69..1374e48 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,7 @@ export type MatomoOptions = disableCookies?: boolean; preconnect?: boolean; debug?: boolean; + partytown?: boolean; } | undefined; diff --git a/src/matomo.ts b/src/matomo.ts index 12d22f3..3792526 100644 --- a/src/matomo.ts +++ b/src/matomo.ts @@ -37,7 +37,7 @@ export function initMatomo(options: MatomoOptions): void { s = d.getElementsByTagName("script")[0]; g.id = "matomo-script"; - g.type = "text/javascript"; + g.type = `text/${options?.partytown ? "partytown" : "javascript"}`; g.async = true; g.defer = true; g.src = u + (options?.srcUrl || "matomo.js");