diff --git a/.prettierrc b/.prettierrc index a77fdde..9573023 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,6 +4,5 @@ "trailingComma": "none", "printWidth": 100, "plugins": ["prettier-plugin-svelte"], - "pluginSearchDirs": ["."], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/README.md b/README.md index 86a1017..bbd479c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ npm i --save-dev @accuser/svelte-plausible-analytics ## Examples -Add Plausible Analytics to the root layout to track page views. +### Add Plausible Analytics to the root layout to track page views. ```svelte + + + + +``` + +Set custom properties in the `pageviewProps` Svelte prop on the `` component. *Beware hydration race conditions and take note when `` is mounted. Especially with SSG.* + +The Plausible-required `event-` prefix can be omitted. Eg. `` becomes ``. + +*Note*: as per the [Plausible documentation](https://plausible.io/docs/custom-props/introduction#limits), up to 30 custom properties can be included alongside a pageview by adding multiple attributes. There is also a 300/2000 character limit on each property `key` and `value`, respectively. + +### Track analytics events: ```svelte +