Skip to content

📈 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!

add docusaurus guide

hirusha-adi74a96162ab07
diff --git a/docs/integrations/docusaurus.md b/docs/integrations/docusaurus.md
new file mode 100644
index 000000000..4225caf23
--- /dev/null
+++ b/docs/integrations/docusaurus.md
@@ -0,0 +1,39 @@
+---
+title: Docusaurus
+slug: /docusaurus-integration
+---
+
+After you sign up on Swetrix and create a new project, the only thing left is to add it to your website.
+
+## Installation
+1. Open your Docusaurus project.
+2. Edit the `docusaurus.config.js` file and add the following inside `module.exports`:
+
+```js
+module.export = {
+ ...
+ scripts: [
+ { src: 'https://swetrix.org/swetrix.js', defer: true },
+ { src: 'js/setupswetrix.js', defer: true }
+ ],
+ ...
+}
+```
+
+3. Create a new file at `static/js/setupswetrix.js` and add the following:
+
+```js
+document.addEventListener('DOMContentLoaded', function () {
+ swetrix.init('YOUR_PROJECT_ID')
+ swetrix.trackViews()
+})
+```
+
+:::caution
+It's very important not to forget to replace `YOUR_PROJECT_ID` with your actual Project ID you can find in the Dashboard, otherwise tracking won't work!
+:::
+
+## Check your installation
+After installing Swetrix tracking script, go to your website and visit some pages.
+
+Within a minute you should be able to see new pageviews being added to your project's dahsboard.
diff --git a/sidebars.js b/sidebars.js
index 24ccb7374..e0ac7d0d0 100644
--- a/sidebars.js
+++ b/sidebars.js
@@ -15,6 +15,7 @@ module.exports = {
'integrations/framer',
'integrations/wix',
'integrations/ghost',
+ 'integrations/docusaurus',
'integrations/django',
'integrations/google-tag-manager',
'integrations/sveltekit',