Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Update documentation for traffic filtering, user identification, and integration guides

Bill Yang8f711767e2c9
diff --git a/docs/content/docs/filter-traffic.mdx b/docs/content/docs/filter-traffic.mdx
index 822b0b241..2f364e02e 100644
--- a/docs/content/docs/filter-traffic.mdx
+++ b/docs/content/docs/filter-traffic.mdx
@@ -43,13 +43,6 @@ All countries are supported using 2-letter ISO country codes (ISO 3166-1 alpha-2
- **Case-insensitive**: Both `US` and `us` are accepted
- **Maximum**: Up to 250 countries can be excluded
-### Use Cases
-
-- **Filter bot traffic**: Block countries known for generating bot traffic
-- **Privacy compliance**: Exclude regions for data protection requirements
-- **Analytics accuracy**: Remove traffic from regions where your service isn't available
-- **Development testing**: Block production traffic from specific regions during testing
-
### Key Features
- **Server-side filtering**: Traffic is blocked before it reaches your analytics database
@@ -89,30 +82,3 @@ You can use both IP and country exclusions together for comprehensive filtering:
- **IP exclusions** are checked first, then **country exclusions**
- Both filters work at the server level before data reaches your database
- Excluded events return a `200` status code but with a message indicating they were not tracked
-
-## API Access
-
-Both IP and country exclusions can be managed via the API:
-
-### Get Excluded IPs
-```bash
-GET /api/site/:siteId/excluded-ips
-```
-
-### Get Excluded Countries
-```bash
-GET /api/site/:siteId/excluded-countries
-```
-
-### Update Site Configuration
-```bash
-POST /api/site/:siteId/config
-Content-Type: application/json
-
-{
- "excludedIPs": ["192.168.1.0/24", "10.0.0.1"],
- "excludedCountries": ["US", "GB", "CN"]
-}
-```
-
-See the [API documentation](/docs/api/stats-api) for more details on authentication and request formats.
diff --git a/docs/content/docs/guides/angular.mdx b/docs/content/docs/guides/angular.mdx
index 3469a43d3..d5d87fd95 100644
--- a/docs/content/docs/guides/angular.mdx
+++ b/docs/content/docs/guides/angular.mdx
@@ -87,11 +87,11 @@ After building and deploying your application, open your Rybbit dashboard to che
// this.router.events.pipe(
// filter(event => event instanceof NavigationEnd)
- // ).subscribe(() => {{
- // if (window.rybbit) {{
+ // ).subscribe(() => {
+ // if (window.rybbit) {
// window.rybbit.pageview();
- // }}
- // }});
+ // }
+ // });
```
However, test the default behavior first, as manual tracking might not be necessary.
</Callout>
@@ -115,18 +115,18 @@ declare global {
}
}
-@Component({{
+@Component({
selector: 'app-my-feature',
template: `<button (click)="onFeatureClick()">Use Feature</button>`,
-}})
-export class MyFeatureComponent {{
- onFeatureClick(): void {{
- if (window.rybbit && typeof window.rybbit.event === 'function') {{
- window.rybbit.event('feature_used', {{ featureName: 'Amazing Feature' }});
- }} else {{
+})
+export class MyFeatureComponent {
+ onFeatureClick(): void {
+ if (window.rybbit && typeof window.rybbit.event === 'function') {
+ window.rybbit.event('feature_used', { featureName: 'Amazing Feature' });
+ } else {
console.warn('Rybbit tracking not available.');
- }}
- }}
-}}
+ }
+ }
+}
```
Declaring `window.rybbit` helps with TypeScript type checking. Always ensure `window.rybbit` and its methods are available before calling them.
\ No newline at end of file
diff --git a/docs/content/docs/guides/mintlify.mdx b/docs/content/docs/guides/mintlify.mdx
index e1dcc5e30..334f9f8b9 100644
--- a/docs/content/docs/guides/mintlify.mdx
+++ b/docs/content/docs/guides/mintlify.mdx
@@ -118,6 +118,7 @@ Since Mintlify supports MDX, you can add inline event handlers to track custom e
Download Guide
</button>
```
+
## Related Resources
- [Rybbit Script Configuration](/docs/script)
diff --git a/docs/content/docs/guides/react/gatsby.mdx b/docs/content/docs/guides/react/gatsby.mdx
index 1e67590e4..333263498 100644
--- a/docs/content/docs/guides/react/gatsby.mdx
+++ b/docs/content/docs/guides/react/gatsby.mdx
@@ -14,10 +14,13 @@ This guide explains how to integrate Rybbit with your Gatsby site for analytics
The recommended way to add a script that should appear on every page in a Gatsby site is by using the `onRenderBody` API in `gatsby-ssr.js`. This ensures the script is included in the HTML generated during the build process.
<Steps>
+<Step>
### Retrieve Your Tracking Script Details
Navigate to your Rybbit dashboard to obtain your **Site ID**. The script source will be `https://app.rybbit.io/api/script.js`.
+</Step>
+<Step>
### Modify `gatsby-ssr.js`
Create a `gatsby-ssr.js` file at the root of your Gatsby project if it doesn't already exist. Add the following code to it:
@@ -39,10 +42,13 @@ export const onRenderBody = ({ setHeadComponents }) => {
};
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard. This will add the Rybbit script to the `<head>` of every page generated by Gatsby.
+</Step>
+<Step>
### Verify Installation
After rebuilding and deploying your Gatsby site (e.g., `gatsby build` and then serve the `public` folder, or your deployment process), open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded on your pages.
+</Step>
</Steps>
### Alternative: Using `gatsby-plugin-script`
diff --git a/docs/content/docs/guides/react/next-js.mdx b/docs/content/docs/guides/react/next-js.mdx
index 2a1394db9..9d86c8b1f 100644
--- a/docs/content/docs/guides/react/next-js.mdx
+++ b/docs/content/docs/guides/react/next-js.mdx
@@ -12,14 +12,19 @@ Next.js is a popular React framework that enables features like server-side rend
## How to Add Rybbit to Next.js
<Steps>
+<Step>
### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your site ID. You'll need this for the `data-site-id` attribute.
+</Step>
+<Step>
### Install the Script Using Next.js Script Component
Next.js provides a built-in [Script component](https://nextjs.org/docs/app/building-your-application/optimizing/scripts) that handles script loading efficiently. This is the recommended approach.
+</Step>
+<Step>
### Add to Your Layout File
Create or modify your layout file depending on your Next.js version:
@@ -68,6 +73,7 @@ function MyApp({ Component, pageProps }) {
export default MyApp
```
+</Step>
</Steps>
### (optional) 4. Rewrite the script serving to bypass ad blockers
diff --git a/docs/content/docs/guides/react/remix.mdx b/docs/content/docs/guides/react/remix.mdx
index 24795a3de..0246dda64 100644
--- a/docs/content/docs/guides/react/remix.mdx
+++ b/docs/content/docs/guides/react/remix.mdx
@@ -14,6 +14,7 @@ This guide explains how to integrate Rybbit with your Remix application for anal
The recommended way to add a script that should appear on every page in a Remix application is by including it in your root layout file, typically `app/root.tsx` (or `app/root.jsx`).
<Steps>
+<Step>
### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:
@@ -26,7 +27,9 @@ Navigate to your Rybbit dashboard to obtain your code snippet. It will look like
></script>
```
Remember to replace `YOUR_SITE_ID` with your actual Site ID.
+</Step>
+<Step>
### Add the Snippet to `app/root.tsx`
Open your `app/root.tsx` (or `app/root.jsx`) file. This file defines the root HTML structure for your application. Add the Rybbit tracking snippet within the `<head>` section of the returned JSX.
@@ -67,10 +70,13 @@ export default function App() {
}
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID. You can define it as a constant or directly in the script tag.
+</Step>
+<Step>
### Verify Installation
After restarting your Remix development server or deploying your application, open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
+</Step>
</Steps>
<Callout type="info">
diff --git a/docs/content/docs/guides/react/vite-cra.mdx b/docs/content/docs/guides/react/vite-cra.mdx
index 516221265..af5d94bff 100644
--- a/docs/content/docs/guides/react/vite-cra.mdx
+++ b/docs/content/docs/guides/react/vite-cra.mdx
@@ -18,6 +18,7 @@ The recommended and simplest method to add the Rybbit tracking script is directl
This is the most straightforward method and ensures the script is loaded early.
<Steps>
+<Step>
### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:
@@ -30,12 +31,16 @@ Navigate to your Rybbit dashboard to obtain your code snippet. It will look like
></script>
```
Remember to replace `YOUR_SITE_ID` with your actual Site ID.
+</Step>
+<Step>
### Locate Your `index.html` File
- For **Create React App (CRA)**: This file is typically located at `public/index.html`.
- For **Vite (React template)**: This file is typically located at the root of your project as `index.html`.
+</Step>
+<Step>
### Add the Snippet to `index.html`
Open your `index.html` file and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag. Placing it in the `<head>` allows it to load sooner.
@@ -63,10 +68,13 @@ Open your `index.html` file and paste the Rybbit tracking snippet just before th
</html>
```
Make sure to replace `YOUR_SITE_ID` with your actual Site ID.
+</Step>
+<Step>
### Verify Installation
After deploying your application, open your Rybbit dashboard to see if data is being received. You can also check your browser's network tab to ensure `script.js` is loaded.
+</Step>
</Steps>
<Callout type="info">
diff --git a/docs/content/docs/guides/svelte/sveltekit.mdx b/docs/content/docs/guides/svelte/sveltekit.mdx
index 8b3f5294a..fd552835b 100644
--- a/docs/content/docs/guides/svelte/sveltekit.mdx
+++ b/docs/content/docs/guides/svelte/sveltekit.mdx
@@ -16,6 +16,7 @@ The recommended and most straightforward method for SvelteKit is to add the Rybb
### Adding to `src/app.html`
<Steps>
+<Step>
### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet:
@@ -28,11 +29,15 @@ Navigate to your Rybbit dashboard to obtain your code snippet:
></script>
```
Replace `YOUR_SITE_ID` with your actual Site ID.
+</Step>
+<Step>
### Locate Your `app.html` File
In a SvelteKit project, this file is typically located at `src/app.html`.
+</Step>
+<Step>
### Add the Snippet to `app.html`
Open `src/app.html` and paste the Rybbit tracking snippet into the `<head>` section, usually before `%sveltekit.head%` or just after it.
@@ -58,10 +63,13 @@ Open `src/app.html` and paste the Rybbit tracking snippet into the `<head>` sect
</html>
```
Ensure `YOUR_SITE_ID` is replaced.
+</Step>
+<Step>
### Verify Installation
Deploy your application and check your Rybbit dashboard for incoming data.
+</Step>
</Steps>
<Callout type="info">
diff --git a/docs/content/docs/guides/svelte/vite.mdx b/docs/content/docs/guides/svelte/vite.mdx
index cb6bbac38..64ec867bb 100644
--- a/docs/content/docs/guides/svelte/vite.mdx
+++ b/docs/content/docs/guides/svelte/vite.mdx
@@ -14,6 +14,7 @@ This guide explains how to integrate Rybbit with your standard client-side Svelt
The most straightforward method is to add the Rybbit tracking script directly to your `index.html` file.
<Steps>
+<Step>
### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet:
@@ -26,11 +27,15 @@ Navigate to your Rybbit dashboard to obtain your code snippet:
></script>
```
Replace `YOUR_SITE_ID` with your actual Site ID.
+</Step>
+<Step>
### Locate Your `index.html` File
For Vite-based Svelte projects, this file is typically located at the root of your project as `index.html`.
+</Step>
+<Step>
### Add the Snippet to `index.html`
Open `index.html` and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag.
@@ -58,10 +63,13 @@ Open `index.html` and paste the Rybbit tracking snippet just before the closing
</html>
```
Ensure `YOUR_SITE_ID` is replaced.
+</Step>
+<Step>
### Verify Installation
Deploy your application and check your Rybbit dashboard for incoming data. You can also inspect your browser's network tab to confirm `script.js` is loaded.
+</Step>
</Steps>
<Callout type="info">
diff --git a/docs/content/docs/guides/vue/nuxt.mdx b/docs/content/docs/guides/vue/nuxt.mdx
index 126dc2ccd..5bd58985c 100644
--- a/docs/content/docs/guides/vue/nuxt.mdx
+++ b/docs/content/docs/guides/vue/nuxt.mdx
@@ -14,10 +14,13 @@ This guide explains how to integrate Rybbit with your Nuxt.js application for an
This is the recommended method for Nuxt.js applications.
<Steps>
+<Step>
### Retrieve Your Site ID
Navigate to your Rybbit dashboard to obtain your Site ID. You'll need this for the `data-site-id` attribute in the script configuration.
+</Step>
+<Step>
### Modify `nuxt.config.ts` (or `.js`)
**For Nuxt 3:**
@@ -61,10 +64,13 @@ export default {
}
```
Ensure you replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard. This method ensures the script is included in the `<head>` of all your pages.
+</Step>
+<Step>
### Verify Installation
After restarting your Nuxt.js development server or deploying your application, open your Rybbit dashboard to check if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
+</Step>
</Steps>
<Callout type="info">
diff --git a/docs/content/docs/guides/vue/vite.mdx b/docs/content/docs/guides/vue/vite.mdx
index aead40774..d62de6156 100644
--- a/docs/content/docs/guides/vue/vite.mdx
+++ b/docs/content/docs/guides/vue/vite.mdx
@@ -16,6 +16,7 @@ The recommended and simplest method for client-side Vue applications is to add t
### Adding to `index.html`
<Steps>
+<Step>
### Retrieve Your Tracking Script
Navigate to your Rybbit dashboard to obtain your code snippet:
@@ -28,11 +29,15 @@ Navigate to your Rybbit dashboard to obtain your code snippet:
></script>
```
Replace `YOUR_SITE_ID` with your actual Site ID.
+</Step>
+<Step>
### Locate Your `index.html` File
This file is typically located at the root of your Vite-based Vue project.
+</Step>
+<Step>
### Add the Snippet to `index.html`
Open `index.html` and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag. Placing it in the `<head>` allows it to load sooner.
@@ -60,10 +65,13 @@ Open `index.html` and paste the Rybbit tracking snippet just before the closing
</html>
```
Ensure `YOUR_SITE_ID` is replaced with your actual Site ID.
+</Step>
+<Step>
### Verify Installation
Deploy your application and check your Rybbit dashboard for incoming data. You can also inspect your browser's network tab to confirm that `script.js` is loaded.
+</Step>
</Steps>
<Callout type="info">
diff --git a/docs/content/docs/identify-users.mdx b/docs/content/docs/identify-users.mdx
index d3268b1aa..2f66ed852 100644
--- a/docs/content/docs/identify-users.mdx
+++ b/docs/content/docs/identify-users.mdx
@@ -3,6 +3,10 @@ title: Identify Users
description: How to identify and track logged-in users with Rybbit
---
+<Callout type="warn" title="GDPR & Privacy Compliance">
+User identification involves processing personal data. Before using these features, ensure you have a lawful basis for processing (typically user consent), have disclosed tracking in your privacy policy, and provide users the ability to access and delete their data. Only collect traits you have explicit consent to process.
+</Callout>
+
Rybbit allows you to identify logged-in users and associate their activity with a persistent identity across devices and sessions. This enables powerful user-level analytics, including tracking user journeys, understanding retention, and personalizing experiences.
## How It Works