📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
added trackPageview docs
Blue Mousea8c2b7acf788
diff --git a/docs/script-reference.md b/docs/script-reference.mdindex faa3484a1..177a21922 100644--- a/docs/script-reference.md+++ b/docs/script-reference.md@@ -108,3 +108,21 @@ The `trackViews` function returns a `Promise` with an object with some methods astop() {},}```++## trackPageview()+This function is used to manually track a page view event.+It's useful if your application uses esoteric routing which is not supported by Swetrix by default.++This function takes the following arguments:+1. `path` - the path of the page you want to track.+2. (optional) `prev` - the path of the previous page user visited.+3. (optional) `unique` - if set to `true`, only 1 event with the same ID will be saved per user session.++Here are some examples of how to use this function:+```javascript+// Track a page view with a path '/hello' and no previous page.+swetrix.trackPageview('/hello')++// Track a page view with a path '/hello' and previous page '/world'.+swetrix.trackPageview('/hello', '/world')+```