Skip to content

Commit

Permalink
feat: add crossorigin support
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-berlin committed May 16, 2024
1 parent 271b012 commit 32dd133
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ yarn add astro-matomo
| `srcUrl?` | `string` | Defaults to matomo.js |
| `debug?` | `boolean` | Activate debug mode |
| `partytown?` | `boolean` | Adds [Partytown](https://partytown.builder.io/) support. Matomo added as: `<script type="text/partytown">...</script>` |
| `crossOrigin?` | `string` | Set `crossorigin` attribute |

## Example usage

Expand Down
2 changes: 2 additions & 0 deletions src/matomo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export function initMatomo(options: MatomoOptions): void {
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];

if (options?.crossOrigin) g.crossOrigin = options.crossOrigin;

g.id = "matomo-script";
g.type = `text/${options?.partytown ? "partytown" : "javascript"}`;
g.async = true;
Expand Down

0 comments on commit 32dd133

Please sign in to comment.