Skip to content

Commit

Permalink
feat: add partytown integration
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-berlin committed May 5, 2024
1 parent bde9bf6 commit 8c883fd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type MatomoOptions =
disableCookies?: boolean;
preconnect?: boolean;
debug?: boolean;
partytown?: boolean;
}
| undefined;

Expand Down
2 changes: 1 addition & 1 deletion src/matomo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 8c883fd

Please sign in to comment.