🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add more integrations (#377)
Bill Yang8b0ffeb1f0c5
diff --git a/.claude/settings.local.json b/.claude/settings.local.jsonnew file mode 100644index 000000000..e8f289d70--- /dev/null+++ b/.claude/settings.local.json@@ -0,0 +1,3 @@+{+ "enableAllProjectMcpServers": false+}\ No newline at end of filediff --git a/docs/src/content/_meta.js b/docs/src/content/_meta.jsindex 679365dfd..a3fb28f01 100644--- a/docs/src/content/_meta.js+++ b/docs/src/content/_meta.js@@ -8,7 +8,7 @@ export default {script: "","track-events": "",sdks: "SDKs",- integrations: "",+ guides: "","hiding-own-traffic": "",_4: {type: "separator",diff --git a/docs/src/content/guides/_meta.json b/docs/src/content/guides/_meta.jsonnew file mode 100644index 000000000..117b15b03--- /dev/null+++ b/docs/src/content/guides/_meta.json@@ -0,0 +1,38 @@+{+ "angular": "Angular",+ "astro": "Astro",+ "bubble": "Bubble.io",+ "docusaurus": "Docusaurus",+ "drupal": "Drupal",+ "framer": "Framer",+ "google-tag-manager": "Google Tag Manager",+ "hugo": "Hugo",+ "jekyll": "Jekyll",+ "laravel": "Laravel",+ "react": {+ "title": "React Ecosystem",+ "type": "separator"+ },+ "react-vite-cra": "React (Vite / CRA)",+ "react-next-js": "Next.js (React)",+ "react-gatsby": "Gatsby (React)",+ "react-remix": "Remix (React)",+ "shopify": "Shopify",+ "squarespace": "Squarespace",+ "svelte": {+ "title": "Svelte Ecosystem",+ "type": "separator"+ },+ "svelte-vite": "Svelte (Vite)",+ "svelte-sveltekit": "SvelteKit",+ "vue": {+ "title": "Vue Ecosystem",+ "type": "separator"+ },+ "vue-vite": "Vue.js (Vite)",+ "vue-nuxt": "Nuxt.js (Vue)",+ "webflow": "Webflow",+ "wix": "Wix",+ "woocommerce": "WooCommerce",+ "wordpress": "WordPress"+}diff --git a/docs/src/content/guides/angular.mdx b/docs/src/content/guides/angular.mdxnew file mode 100644index 000000000..beb9b52fa--- /dev/null+++ b/docs/src/content/guides/angular.mdx@@ -0,0 +1,122 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Angular++This guide explains how to integrate Rybbit with your Angular application.++## How to Add Rybbit to Your Angular App++The recommended and most common method is to add the Rybbit tracking script directly to your `src/index.html` file. This ensures the script is loaded early and reliably for your Angular application.++### Adding to `src/index.html`++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```+Remember to replace `YOUR_SITE_ID` with your actual Site ID.++### 2. Locate Your `index.html` File++In a standard Angular CLI project, this file is typically located at `src/index.html`.++### 3. Add the Snippet to `index.html`++Open `src/index.html` and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag. Placing it in the `<head>` is generally preferred for earlier loading.++```html filename="src/index.html"+<!doctype html>+<html lang="en">+<head>+ <meta charset="utf-8">+ <title>MyAngularApp</title>+ <base href="/">+ <meta name="viewport" content="width=device-width, initial-scale=1">+ <link rel="icon" type="image/x-icon" href="favicon.ico">+ <!-- Rybbit Tracking Snippet -->+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+ ></script>+</head>+<body>+ <app-root></app-root> <!-- Your root Angular component -->+ <!-- If you prefer, you can also place the script here, before </body> -->+</body>+</html>+```+Make sure to replace `YOUR_SITE_ID` with your actual Site ID.++### 4. Verify Installation++After building and 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.+</Steps>++<Callout type="info">+ **SPA Page View Tracking**: Rybbit's tracking script is designed to automatically detect route changes in most Angular applications (using Angular Router) and track them as page views. If you find that page views are not being tracked correctly after navigation, you might need to manually trigger page views. You can subscribe to router events:+ ```typescript+ // In a relevant component or service+ import { Router, NavigationEnd } from '@angular/router';+ import { filter } from 'rxjs/operators';++ // ...+ // constructor(private router: Router) {}+ // ...++ // this.router.events.pipe(+ // filter(event => event instanceof NavigationEnd)+ // ).subscribe(() => {{+ // if (window.rybbit) {{+ // window.rybbit.trackPageview();+ // }}+ // }});+ ```+ However, test the default behavior first, as manual tracking might not be necessary.+</Callout>++## Custom Event Tracking++Once the Rybbit script is installed and loaded, you can track custom events from any of your Angular components or services:++```typescript+// Example in an Angular component+import { Component } from '@angular/core';++// Declare rybbit on window for TypeScript+declare global {+ interface Window {+ rybbit?: {+ trackEvent: (eventName: string, eventData?: Record<string, any>) => void;+ trackPageview: () => void;+ // Add other methods if you use them+ };+ }+}++@Component({{+ selector: 'app-my-feature',+ template: `<button (click)="onFeatureClick()">Use Feature</button>`,+}})+export class MyFeatureComponent {{+ onFeatureClick(): void {{+ if (window.rybbit && typeof window.rybbit.trackEvent === 'function') {{+ window.rybbit.trackEvent('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 filediff --git a/docs/src/content/guides/astro.mdx b/docs/src/content/guides/astro.mdxnew file mode 100644index 000000000..896decc21--- /dev/null+++ b/docs/src/content/guides/astro.mdx@@ -0,0 +1,132 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Astro++This guide explains how to integrate Rybbit with your Astro application for analytics tracking. Astro is a web framework for building content-rich websites, delivering minimal JavaScript by default.++## How to Add Rybbit to Your Astro Site++The most common way to add a global script like Rybbit's to an Astro site is by including it in a common layout component that is used across your pages, or directly within the `<head>` of your pages if you don't use a shared layout.++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```+Remember to replace `YOUR_SITE_ID` with your actual Site ID.++### 2. Add the Snippet to a Common Layout or Page Head++**Using a Common Layout (Recommended):**++If you have a common layout component (e.g., `src/layouts/Layout.astro` or similar) that wraps your pages, this is the best place to add the script.++Open your layout file and add the Rybbit script tag within the `<head>` section.++```astro filename="src/layouts/Layout.astro"+---+// src/layouts/Layout.astro+export interface Props {+ title: string;+}++const { title } = Astro.props;+const rybbitSiteId = "YOUR_SITE_ID"; // Replace with your actual Site ID+---+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="description" content="Astro description" />+ <meta name="viewport" content="width=device-width" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <meta name="generator" content={Astro.generator} />+ <title>{title}</title>++ <!-- Rybbit Tracking Snippet -->+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id={rybbitSiteId}+ async+ defer+ ></script>+ </head>+ <body>+ <slot /> <!-- Page content will be injected here -->+ </body>+</html>+```+Make sure to replace `YOUR_SITE_ID` with your actual Site ID.++**Adding Directly to Individual Pages (If not using a common layout):**++If you don't have a common layout, you can add the script to the `<head>` of each `.astro` page file in your `src/pages/` directory. However, using a layout is more maintainable.++### 3. Verify Installation++After building and deploying your Astro site, 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.+</Steps>++<Callout type="info">+ **Page View Tracking in Astro**:+ - **MPA (Multi-Page Application) Mode**: By default, Astro builds multi-page applications. When a user navigates between different pages, a full page load occurs, and Rybbit's script will naturally track this as a new page view.+ - **View Transitions**: If you are using Astro's [View Transitions API](https://docs.astro.build/en/guides/view-transitions/) for client-side navigation effects, Rybbit's script should generally still detect these as page views if the URL changes. However, if you notice issues, you might need to manually trigger page views. You can listen to Astro's `astro:after-swap` event:+ ```javascript+ // In a client-side script, perhaps in your common layout or a global script file+ document.addEventListener('astro:after-swap', () => {+ if (window.rybbit) {+ window.rybbit.trackPageview();+ }+ });+ ```+ Test the default behavior first.+</Callout>++## Custom Event Tracking++You can track custom events from client-side JavaScript within your Astro site. This can be done in `<script>` tags within your `.astro` files or from JavaScript modules imported into Astro components (especially within UI framework components used as Astro islands).++**Example in an Astro component's client-side script:**+```astro+---+// src/components/MyButton.astro+---+<button id="my-astro-button">Click Me in Astro</button>++<script>+ document.getElementById('my-astro-button')?.addEventListener('click', () => {+ if (window.rybbit) {+ window.rybbit.trackEvent('astro_button_click', { source: 'MyButton.astro' });+ }+ });+</script>+```++**Example within a React/Vue/Svelte island component used in Astro:**++If you're using a UI framework component (e.g., React) as an island in Astro, you'd track events from within that component's logic, similar to how you would in a standalone app of that framework:++```jsx+// src/components/MyReactIsland.jsx (used in an .astro file)+import React from 'react';++export default function MyReactIsland() {+ const handleClick = () => {+ if (window.rybbit) {+ window.rybbit.trackEvent('react_island_click', { island: 'MyReactIsland' });+ }+ };+ return <button onClick={handleClick}>Click Me (React Island)</button>;+}+```++Always ensure `window.rybbit` is available before calling its methods in client-side scripts.\ No newline at end of filediff --git a/docs/src/content/guides/bubble.mdx b/docs/src/content/guides/bubble.mdxnew file mode 100644index 000000000..08104bce2--- /dev/null+++ b/docs/src/content/guides/bubble.mdx@@ -0,0 +1,108 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Bubble.io++This guide explains how to integrate Rybbit with your Bubble.io application to track user behavior, page views, and custom events.++## How to Add Rybbit to Your Bubble App++Bubble allows you to add custom code, including JavaScript snippets, to the header of your pages.++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```+Remember to replace `YOUR_SITE_ID` with your actual Site ID.++### 2. Access Your Bubble App Settings++- Open your Bubble application in the editor.+- Navigate to the **Settings** tab in the left-hand sidebar.+- Go to the **SEO / metatags** sub-tab.++### 3. Add the Snippet to the Page Header++- Scroll down to the section titled **"Script/meta tags in header"**.+- Paste your Rybbit tracking snippet into this box. This will add the script to the `<head>` section of every page in your Bubble app.++Alternatively, some Bubble plans or configurations might offer a dedicated section for "Advanced Settings" or "Custom Code" where header scripts can be placed globally or on specific pages. The "SEO / metatags" header script section is generally the most common place for global scripts.++### 4. Deploy Your App++- After adding the script, ensure you deploy your Bubble application to the live version for the changes to take effect.++### 5. Verify Installation++Open your live Bubble application and navigate through a few pages. Then, check your Rybbit dashboard to see if data is being received. You can also inspect your browser's network tab to confirm that `script.js` is loaded.+</Steps>++<Callout type="info">+ **Page View Tracking in Bubble Apps**: Bubble applications often behave like Single Page Applications (SPAs) for navigation between "pages" (which are often groups shown/hidden on a single actual HTML page). Rybbit's script is designed to detect URL changes in SPAs.+ - If your Bubble app uses actual URL route changes for different views, Rybbit should track these automatically.+ - If navigation primarily involves showing/hiding groups without URL changes, Rybbit will only track the initial page load. For more granular tracking of "virtual" page views in such cases, you would need to use custom event tracking.+ - If URL changes occur but are not automatically tracked, you might need to trigger `window.rybbit.trackPageview()` manually using a Bubble workflow action that runs JavaScript when a "page" (group) becomes visible.+</Callout>++## Custom Event Tracking in Bubble++You can track custom events in Bubble by using a workflow action that runs JavaScript.++<Steps>+### 1. Create a Workflow++- In the Bubble editor, go to the **Workflow** tab.+- Create a new workflow triggered by the event you want to track (e.g., "When Button A is clicked", "When a user's data changes", "When a page is loaded" and a certain condition is met).++### 2. Add "Run JavaScript" Action++- Within your workflow, add a new action.+- Search for and select the **"Run JavaScript"** action (this might be provided by a free official Bubble plugin or a community plugin if not available by default; ensure you have a way to execute arbitrary JS).++### 3. Add Rybbit Tracking Code++- In the "Run JavaScript" action's code block, add your Rybbit event tracking code:++```javascript+if (typeof window.rybbit !== 'undefined') {+ window.rybbit.trackEvent('bubble_event_name', {+ // You can use Bubble's dynamic expressions here to pass data+ // For example: 'User Email': Current User's Email,+ // 'Clicked Element': This Button's Text (if applicable)+ property1: 'value1',+ property2: 'value2'+ });+}+```+Replace `'bubble_event_name'` with a descriptive name for your event. You can use Bubble's dynamic data expressions within the JavaScript if the "Run JavaScript" action supports it, or pass data into the JavaScript action from previous workflow steps.++**Example:** If tracking a button click for a specific item:+```javascript+// Assuming you can pass dynamic data to the JS action+// let itemName = "Dynamic Item Name from Bubble"; // This would be set by Bubble's dynamic data+// let itemCategory = "Dynamic Category from Bubble";++if (typeof window.rybbit !== 'undefined') {+ window.rybbit.trackEvent('item_interaction', {+ name: itemName, // Replace with actual dynamic data+ category: itemCategory // Replace with actual dynamic data+ });+}+```++### 4. Test Your Event++- Preview your Bubble app and trigger the workflow.+- Check your Rybbit dashboard to see if the custom event data is being received.+</Steps>++By adding the global script and using "Run JavaScript" workflow actions, you can effectively integrate Rybbit analytics into your Bubble.io application.\ No newline at end of filediff --git a/docs/src/content/guides/docusaurus.mdx b/docs/src/content/guides/docusaurus.mdxnew file mode 100644index 000000000..21e09e654--- /dev/null+++ b/docs/src/content/guides/docusaurus.mdx@@ -0,0 +1,139 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Docusaurus++This guide explains how to integrate Rybbit with your Docusaurus v2+ website for analytics tracking. Docusaurus is a static site generator that builds a single-page application with React.++## How to Add Rybbit to Your Docusaurus Site++Docusaurus provides a configuration option to add scripts or tags to the `<head>` of every page, which is the recommended way to include Rybbit.++<Steps>+### 1. 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`.++### 2. Modify `docusaurus.config.js`++Open your `docusaurus.config.js` (or `docusaurus.config.ts` if using TypeScript) file, which is typically located at the root of your Docusaurus project.++You can add the Rybbit script using the `scripts` array or the `headTags` array within your site configuration. Using `scripts` is often cleaner for simple script additions.++**Using the `scripts` configuration:**++```javascript filename="docusaurus.config.js"+// @ts-check+// Note: type annotations allow type checking and IDEs autocompletion++/** @type {import('@docusaurus/types').Config} */+const config = {+ // ... other configurations (title, tagline, favicon, url, baseUrl, organizationName, projectName, etc.)++ presets: [+ // ... your presets+ ],++ themeConfig:+ /** @type {import('@docusaurus/preset-classic').ThemeConfig} */+ ({+ // ... your themeConfig+ }),++ // Add Rybbit script here+ scripts: [+ {+ src: 'https://app.rybbit.io/api/script.js',+ async: true,+ defer: true,+ 'data-site-id': 'YOUR_SITE_ID', // Replace with your actual Site ID+ },+ // You can add other scripts here if needed+ ],++ // Alternatively, using headTags (more verbose for simple scripts):+ // headTags: [+ // {+ // tagName: 'script',+ // attributes: {+ // async: true,+ // defer: true,+ // src: 'https://app.rybbit.io/api/script.js',+ // 'data-site-id': 'YOUR_SITE_ID', // Replace+ // },+ // },+ // ],+};++module.exports = config;+```+Make sure to replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.++### 3. Verify Installation++After rebuilding and deploying your Docusaurus site (e.g., `npm run build` and `npm run serve`, 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.+</Steps>++<Callout type="info">+ **Page View Tracking**: Docusaurus builds a Single Page Application (SPA). Rybbit's tracking script is designed to automatically detect route changes in SPAs and track them as page views. If you find that page views are not being tracked correctly after client-side navigation (which is uncommon), you might need to manually trigger page views. Docusaurus uses React Router internally. You could potentially use a client module or swizzle a component to tap into navigation events if manual tracking is absolutely necessary, but **test the default behavior first**.+ If manual tracking is required, you would call `window.rybbit.trackPageview()` after a route change.+</Callout>++## Custom Event Tracking++Since Docusaurus uses React, you can track custom events from any of your custom React components or by using client modules.++**Example in a custom React component used in Docusaurus:**+```jsx+// src/components/MyCustomButton.jsx+import React from 'react';++export default function MyCustomButton({ children, eventName, eventData }) {+ const handleClick = () => {+ if (typeof window !== 'undefined' && window.rybbit) {+ window.rybbit.trackEvent(eventName || 'docusaurus_custom_click', eventData || {});+ }+ };++ return (+ <button onClick={handleClick} className="button button--primary margin--sm">+ {children}+ </button>+ );+}+```+You can then use this component in your MDX files:+```mdx+import MyCustomButton from '@site/src/components/MyCustomButton';++<MyCustomButton eventName="learn_more_clicked" eventData={{ page: 'introduction' }}>+ Learn More+</MyCustomButton>+```++**Using Client Modules:**+Docusaurus allows you to run JavaScript on page load using [Client Modules](https://docusaurus.io/docs/advanced/client-modules). You could use this to set up global event listeners or track specific initial interactions.++```javascript filename="src/client-modules/rybbit-events.js"+// Example: Track when a user clicks on any external link+export function onRouteUpdate({location, previousLocation}) {+ // This function runs after Docusaurus finishes navigating to a new route.+ // You could also use onRouteDidUpdate if you need the DOM to be fully updated.++ if (typeof window !== 'undefined' && window.rybbit && location.pathname !== previousLocation?.pathname) {+ // Rybbit should auto-track pageviews, but if needed:+ // window.rybbit.trackPageview();+ }++ // Example: Add event listeners for specific elements+ document.querySelectorAll('a[target="_blank"]').forEach(link => {+ link.addEventListener('click', () => {+ if (window.rybbit) {+ window.rybbit.trackEvent('external_link_click', { href: link.href });+ }+ });+ });+}+```++Always ensure `window.rybbit` is available before calling its methods in client-side scripts.\ No newline at end of filediff --git a/docs/src/content/guides/drupal.mdx b/docs/src/content/guides/drupal.mdxnew file mode 100644index 000000000..6b6653396--- /dev/null+++ b/docs/src/content/guides/drupal.mdx@@ -0,0 +1,88 @@+import { Callout } from 'nextra/components'++# Drupal++Integrating Rybbit Analytics with your Drupal site can be done by adding the tracking script to your theme or by using a module that allows adding custom JavaScript.++## 1. Get Your Tracking Script++First, you'll need your Rybbit tracking script. You can find this in your Rybbit dashboard under **Site Settings > Tracking Code**. It will look something like this:++```html+<script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+```++Replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.++## Method 1: Adding to Your Theme (Recommended for Themers)++If you are comfortable editing your Drupal theme files, this is a direct way to add the script.++**a. Locate your theme's `html.html.twig` file:**+This file is responsible for the overall HTML structure of your pages. You can typically find it in your active theme's directory:+`themes/custom/your_theme_name/templates/layout/html.html.twig`++If your custom theme doesn't have one, you might need to copy it from your base theme (e.g., Stable, Classy) or from Drupal core (`core/themes/stable/templates/layout/html.html.twig`).++**b. Add the script:**+Open the `html.html.twig` file and paste the Rybbit tracking script just before the closing `</body>` tag.++```twig+{# ... existing content ... #}+ <js-bottom-placeholder token="{{ placeholder_token }}">+ </body>+</html>+```++Modify it to include the script:++```twig+{# ... existing content ... #}+ <js-bottom-placeholder token="{{ placeholder_token }}">++ {# Rybbit Analytics Script #}+ <script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+ </body>+</html>+```+Replace `YOUR_SITE_ID` with your actual Site ID.++**c. Clear Drupal Caches:**+After adding the script, you must clear Drupal's caches for the changes to take effect.+- Go to **Manage > Configuration > Development > Performance** (e.g., `/admin/config/development/performance`).+- Click the **Clear all caches** button.+- Alternatively, use Drush: `drush cr`++## Method 2: Using a Module (e.g., "Asset Injector")++For users less comfortable with code, or for more flexible management, a module like [Asset Injector](https://www.drupal.org/project/asset_injector) can be used.++**a. Install and Enable Asset Injector:**+- Download and install the Asset Injector module from Drupal.org.+- Enable the module via **Manage > Extend** (`/admin/modules`).++**b. Add a JavaScript Asset:**+- Go to **Manage > Configuration > Development > Asset Injector** (`/admin/config/development/asset-injector`).+- Click on **JS injector**.+- Click **+ Add JS inject**.+- **Label:** Give it a name like "Rybbit Analytics".+- **Code:** Paste your Rybbit tracking script into the code field.+- **Pages:** Configure where the script should appear. For sitewide tracking, you might select "Add on every page except the listed pages" and leave the list empty, or use specific conditions if needed.+- **Preprocess JavaScript:** Usually, you can leave this unchecked for external scripts.+- **Scope:** Select **Footer** to add the script to the bottom of the page.++**c. Save and Clear Caches:**+- Save the asset.+- Clear Drupal's caches as described in Method 1.++<Callout type="warning">+ Be cautious when adding scripts directly to `html.html.twig` if you are not using a custom theme, as core or contrib theme updates might overwrite your changes. Creating a sub-theme is best practice.+</Callout>++## 3. Verify Integration++- Open your live Drupal website in a browser.+- Navigate through a few pages.+- Check your Rybbit dashboard for incoming data. It might take a few minutes for the first events to appear.++That's it! Rybbit Analytics should now be integrated with your Drupal site.\ No newline at end of filediff --git a/docs/src/content/guides/framer.mdx b/docs/src/content/guides/framer.mdxnew file mode 100644index 000000000..27b39982a--- /dev/null+++ b/docs/src/content/guides/framer.mdx@@ -0,0 +1,97 @@+import { Steps } from "nextra/components"++# Framer++Rybbit enables you to gather analytics on user behavior, capture custom events, record sessions, and more within your Framer site.++## How to Add Rybbit to Framer++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet.++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```++### 2. Add the Snippet to Your Framer Project++- Open your Framer project.+- Go to **Site Settings > General** and scroll down to **Custom Code**.+- Paste your snippet into the `<head>` tag section (start or end).+- Publish your changes.+</Steps>++import { Callout } from "nextra/components"++<Callout type="info">+ **Page View Tracking in Framer**: Framer sites often behave like Single Page Applications (SPAs). Rybbit's tracking script is designed to automatically detect URL changes and track them as page views. If you use Framer's navigation features (like links between pages or components that change the URL), Rybbit should capture these. If you notice page views are not tracked correctly after navigation, you might need to manually trigger `window.rybbit.trackPageview()` using a Framer code override or code component when a "virtual" page change occurs. Test the default behavior first.+</Callout>++## Custom Event Tracking in Framer++You can track custom events in Framer using **Code Overrides** or by creating **Code Components**. This allows you to trigger Rybbit tracking calls in response to user interactions.++**Example using a Code Override on a button:**++1. Select the button or interactive element in Framer.+2. In the properties panel on the right, find "Overrides" and click "+ File" to create a new override file (e.g., `MyButtonOverrides.tsx`) or select an existing one.+3. Add the following code to the override file:++```tsx+// MyButtonOverrides.tsx+import type { ComponentType } from "react"++export function withRybbitTracking(Component: ComponentType): ComponentType {+ return (props) => {+ const handleClick = () => {+ if (typeof window !== "undefined" && window.rybbit) {+ window.rybbit.trackEvent('framer_button_click', {+ buttonName: props.text || 'Unnamed Button',+ page: props.currentPage?.name || 'Unknown Page'+ });+ }+ // Call original onClick if it exists+ props.onClick?.();+ };++ return <Component {...props} onClick={handleClick} />+ }+}+```++4. Apply this override to your button component in Framer:+ * Select the button.+ * In the Overrides section, choose the file (`MyButtonOverrides`).+ * Choose the `withRybbitTracking` override for the `onClick` (or relevant interaction) property.++**Example within a Code Component:**++```tsx+// MyInteractiveComponent.tsx+import React from "react"++export function MyInteractiveComponent(props) {+ const handleInteraction = () => {+ if (typeof window !== "undefined" && window.rybbit) {+ window.rybbit.trackEvent('framer_component_interaction', {+ componentName: 'MyInteractiveComponent',+ detail: 'User interacted'+ });+ }+ }++ return (+ <div onClick={handleInteraction} style={{ padding: 20, background: "lightblue", cursor: "pointer" }}>+ Click me to track event+ </div>+ )+}+```+Remember to always check for `window.rybbit` before calling its methods. Publish your Framer site to see the tracking in action.diff --git a/docs/src/content/integrations/google-tag-manager.mdx b/docs/src/content/guides/google-tag-manager.mdxsimilarity index 98%rename from docs/src/content/integrations/google-tag-manager.mdxrename to docs/src/content/guides/google-tag-manager.mdxindex 3b55a7488..27e39d801 100644--- a/docs/src/content/integrations/google-tag-manager.mdx+++ b/docs/src/content/guides/google-tag-manager.mdx@@ -29,6 +29,7 @@ However, GTM sanitizes script tags by removing non-standard HTML attributes likevar el = document.createElement("script");el.src = "https://app.rybbit.io/api/script.js";el.async = true;+ el.defer = true;el.setAttribute("data-site-id", "YOUR_SITE_ID");document.head.appendChild(el);})();diff --git a/docs/src/content/guides/hugo.mdx b/docs/src/content/guides/hugo.mdxnew file mode 100644index 000000000..f92434b93--- /dev/null+++ b/docs/src/content/guides/hugo.mdx@@ -0,0 +1,94 @@+# Hugo++Integrating Rybbit Analytics with your Hugo static site involves adding the tracking script to your site's templates. The best way to do this is by creating a partial template for the script and including it in your site's footer.++## 1. Get Your Tracking Script++First, you'll need your Rybbit tracking script. You can find this in your Rybbit dashboard under **Site Settings > Tracking Code**. It will look something like this:++```html+<script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+```++Replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.++## 2. Create a Partial Template++In your Hugo project, navigate to the `layouts/partials/` directory. If it doesn't exist, create it.++Inside `layouts/partials/`, create a new file named `rybbit-analytics.html` (or a similar name).++Paste your Rybbit tracking script into this new file:++```html+{{/* layouts/partials/rybbit-analytics.html */}}+{{ if not .Site.IsServer }} {{/* Only include in production builds */}}+ <script async defer src="https://your-rybbit-instance.com/api/script.js" data-site-id="YOUR_SITE_ID"></script>+{{ end }}+```++**Explanation:**+- `{{ if not .Site.IsServer }}`: This Hugo condition ensures that the tracking script is only included when you build your site for production (`hugo`) and not during local development (`hugo server`). This prevents tracking your own local page views.+- Replace `https://your-rybbit-instance.com` and `YOUR_SITE_ID` with your actual details.++## 3. Include the Partial in Your Footer++Now, you need to include this partial in your site's main footer template. This is typically located in `layouts/_default/baseof.html` or a theme-specific footer partial (e.g., `layouts/partials/footer.html` or `themes/your-theme/layouts/partials/footer.html`).++Open your main base template or footer partial file. Just before the closing `</body>` tag, add the following line to include your Rybbit Analytics partial:++```html+{{/* ... other footer content ... */}}++{{ partial "rybbit-analytics.html" . }}++</body>+</html>+```++If you named your partial differently, make sure to use that name (e.g., `{{ partial "my-analytics-script.html" . }}`).++## 4. Configure `config.toml` (Optional but Recommended)++To make your Site ID configurable, you can use Hugo's site parameters.++**a. Update `rybbit-analytics.html`:**++Modify `layouts/partials/rybbit-analytics.html` to use a site parameter:++```html+{{/* layouts/partials/rybbit-analytics.html */}}+{{ if and (not .Site.IsServer) .Site.Params.rybbitSiteID }}+ <script async defer src="{{ .Site.Params.rybbitInstanceURL | default "https://app.rybbit.io" }}/api/script.js" data-site-id="{{ .Site.Params.rybbitSiteID }}"></script>+{{ end }}+```++**b. Add parameters to `config.toml` (or `config.yaml` / `config.json`):**++Open your Hugo configuration file (e.g., `config.toml`) and add:++```toml+[params]+ rybbitInstanceURL = "https://app.rybbit.io" # Your Rybbit instance URL+ rybbitSiteID = "YOUR_SITE_ID" # Your Rybbit Site ID+```++This approach keeps your specific IDs out of the templates and makes it easier to manage for different environments if needed.++## 5. Build and Deploy++Rebuild your Hugo site:++```bash+hugo+```++Deploy the generated `public/` directory to your web server.++## 6. Verify Integration++- Open your live Hugo website in a browser.+- Navigate through a few pages.+- Check your Rybbit dashboard for incoming data. It might take a few minutes for the first events to appear.++That's it! Rybbit Analytics is now integrated with your Hugo site and will only track visits on your production deployment.\ No newline at end of filediff --git a/docs/src/content/guides/jekyll.mdx b/docs/src/content/guides/jekyll.mdxnew file mode 100644index 000000000..ba22c8f17--- /dev/null+++ b/docs/src/content/guides/jekyll.mdx@@ -0,0 +1,103 @@+# Jekyll++Integrating Rybbit Analytics with your Jekyll static site involves adding the tracking script to your site's main layout file or by creating an include file.++## 1. Get Your Tracking Script++First, you'll need your Rybbit tracking script. You can find this in your Rybbit dashboard under **Site Settings > Tracking Code**. It will look something like this:++```html+<script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+```++Replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.++## 2. Option A: Add to Default Layout++The simplest way is to add the script directly to your default layout file.++- In your Jekyll project, find your main layout file. This is often `_layouts/default.html`.+- Open this file and paste the Rybbit tracking script just before the closing `</body>` tag.++```html+{{ site.title }}+{{ content }}+<!-- Other footer content -->++<!-- Rybbit Analytics Script -->+{{% raw %}}+{% if jekyll.environment == "production" %}+ <script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+{% endif %}+{{% endraw %}}++</body>+</html>+```++**Explanation:**+- `{{% raw %}}{% if jekyll.environment == "production" %}}{{% endraw %}}`: This Liquid tag condition ensures the script is only included when your site is built for production (e.g., when `JEKYLL_ENV=production jekyll build`). This prevents tracking your local development views.+- Replace `YOUR_SITE_ID` with your actual Site ID. The script source `https://app.rybbit.io/api/script.js` is for the standard cloud-hosted Rybbit instance.++## 3. Option B: Create an Include File (Recommended)++A cleaner approach is to create an include file for the script.++**a. Create the Include File:**+- In your Jekyll project, navigate to the `_includes/` directory. If it doesn't exist, create it.+- Create a new file named `rybbit-analytics.html` (or similar) inside `_includes/`.+- Paste the following into `_includes/rybbit-analytics.html`:++```html+{{% raw %}}+{% comment %} _includes/rybbit-analytics.html {% endcomment %}+{% if jekyll.environment == "production" and site.rybbit_site_id %}+ <script async defer src="{{ site.rybbit_instance_url | default: 'https://app.rybbit.io' }}/api/script.js" data-site-id="{{ site.rybbit_site_id }}"></script>+{% endif %}+{{% endraw %}}+```++**b. Include in Layout:**+- Open your main layout file (e.g., `_layouts/default.html`).+- Just before the closing `</body>` tag, add:++```html+{{ site.title }}+{{ content }}+<!-- Other footer content -->++{{% raw %}}{% include rybbit-analytics.html %}{{% endraw %}}++</body>+</html>+```++**c. Configure `_config.yml`:**+- Open your `_config.yml` file and add your Rybbit details:++```yaml+# Rybbit Analytics Configuration+rybbit_instance_url: "https://app.rybbit.io" # Optional, defaults in include+rybbit_site_id: "YOUR_SITE_ID"+```+This method keeps your credentials in the configuration file and makes the script inclusion conditional on `rybbit_site_id` being set.++## 4. Build and Deploy++Build your Jekyll site. For production, set the `JEKYLL_ENV` environment variable:++```bash+JEKYLL_ENV=production jekyll build+```++Or, if you use GitHub Pages, it typically sets `jekyll.environment` to `production` automatically during its build process.++Deploy the generated `_site/` directory to your web server.++## 5. Verify Integration++- Open your live Jekyll website in a browser.+- Navigate through a few pages.+- Check your Rybbit dashboard for incoming data. It might take a few minutes for the first events to appear.++That's it! Rybbit Analytics is now integrated with your Jekyll site and will only track visits on your production deployment.\ No newline at end of filediff --git a/docs/src/content/guides/laravel.mdx b/docs/src/content/guides/laravel.mdxnew file mode 100644index 000000000..af9c843ca--- /dev/null+++ b/docs/src/content/guides/laravel.mdx@@ -0,0 +1,104 @@+# Laravel++Integrating Rybbit Analytics with your Laravel application is straightforward. You'll typically add the Rybbit tracking script to your main Blade layout file.++## 1. Get Your Tracking Script++First, you'll need your Rybbit tracking script. You can find this in your Rybbit dashboard under **Site Settings > Tracking Code**. It will look something like this:++```html+<script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+```++Replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.++## 2. Locate Your Main Blade Layout File++In a standard Laravel application, you'll have a main layout file that other Blade views extend. This file is often located at:++- `resources/views/layouts/app.blade.php` (common for applications using Laravel's authentication scaffolding)+- Or `resources/views/layouts/main.blade.php` or a similar custom name.+- If you're using Laravel Jetstream or Breeze, the main layout file might be in a slightly different location within `resources/views/`.++Identify the primary layout file that wraps most or all of your site's pages.++## 3. Add the Tracking Script to the Layout++Open your main Blade layout file. Paste the Rybbit tracking script just before the closing `</body>` tag.++```php+<!DOCTYPE html>+<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">+<head>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1">+ <title>{{ config('app.name', 'Laravel') }}</title>+ {{-- Stylesheets, etc. --}}+ @vite(['resources/css/app.css', 'resources/js/app.js']) {{-- Example for Vite --}}+</head>+<body class="font-sans antialiased">+ {{-- Your page content, often using @yield or <slot> --}}+ @yield('content')++ {{-- Other scripts --}}++ {{-- Rybbit Analytics Script --}}+ @if(app()->environment('production'))+ <script async defer src="{{ config('services.rybbit.instance_url', 'https://app.rybbit.io') }}/api/script.js" data-site-id="{{ config('services.rybbit.site_id') }}"></script>+ @endif+</body>+</html>+```++**Explanation:**+- `@if(app()->environment('production'))`: This Blade directive ensures the script is only included when your Laravel application is running in the `production` environment. This prevents tracking during local development.+- `{{ config('services.rybbit.instance_url', 'https://app.rybbit.io') }}/api/script.js` and `{{ config('services.rybbit.site_id') }}`: This is a recommended way to manage your Rybbit credentials using Laravel's configuration system. The `config('services.rybbit.instance_url')` should resolve to your Rybbit instance's base URL (e.g., `https://app.rybbit.io` or your self-hosted URL), and `/api/script.js` is appended to it. The fallback shown ensures it defaults to the cloud-hosted Rybbit script. See step 4 for `.env` configuration.++If you prefer not to use the config helper immediately, you can hardcode the values:+```php+ {{-- Rybbit Analytics Script --}}+ @if(app()->environment('production'))+ <script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+ @endif+```+Remember to replace placeholders with your actual script URL and Site ID.++## 4. Configure Environment Variables (Recommended)++It's best practice to store your Rybbit Site ID and instance URL in your `.env` file and access them via Laravel's configuration.++**a. Add to `.env` file:**+Open your `.env` file and add:++```env+RYBBIT_INSTANCE_URL=https://app.rybbit.io+RYBBIT_SITE_ID=YOUR_SITE_ID+```++**b. Add to `config/services.php`:**+Open (or create if it doesn't exist) `config/services.php` and add a configuration for Rybbit:++```php+<?php++return [+ // ... other services++ 'rybbit' => [+ 'instance_url' => env('RYBBIT_INSTANCE_URL'),+ 'site_id' => env('RYBBIT_SITE_ID'),+ ],+];+```+Now, the Blade template code from Step 3 using `config('services.rybbit.instance_url')` and `config('services.rybbit.site_id')` will work correctly.++Make sure to run `php artisan config:clear` if you've cached your configuration.++## 5. Verify Integration++- Deploy your Laravel application to your production environment (or set `APP_ENV=production` locally for testing, but be mindful of tracking local data).+- Open your live Laravel website in a browser.+- Navigate through a few pages.+- Check your Rybbit dashboard for incoming data. It might take a few minutes for the first events to appear.++That's it! Rybbit Analytics is now integrated with your Laravel application and will only track visits in your production environment.\ No newline at end of filediff --git a/docs/src/content/guides/react/gatsby.mdx b/docs/src/content/guides/react/gatsby.mdxnew file mode 100644index 000000000..6e8de7b02--- /dev/null+++ b/docs/src/content/guides/react/gatsby.mdx@@ -0,0 +1,133 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Gatsby++This guide explains how to integrate Rybbit with your Gatsby site for analytics tracking. Gatsby is a React-based static site generator that builds fast, optimized websites.++## How to Add Rybbit to Your Gatsby Site++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>+### 1. 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`.++### 2. 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:++```javascript filename="gatsby-ssr.js"+import React from 'react';++export const onRenderBody = ({ setHeadComponents }) => {+ const rybbitSiteId = 'YOUR_SITE_ID'; // Replace with your actual Site ID++ setHeadComponents([+ <script+ key="rybbit-analytics-script" // A unique key for React+ src="https://app.rybbit.io/api/script.js"+ data-site-id={rybbitSiteId}+ async+ defer+ />,+ ]);+};+```+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.++### 3. 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.+</Steps>++### Alternative: Using `gatsby-plugin-script`++Gatsby also offers `gatsby-plugin-script` for more fine-grained control over script loading. If you prefer this method:++1. Install the plugin: `npm install gatsby-plugin-script` or `yarn add gatsby-plugin-script`.+2. Add it to your `gatsby-config.js`:++```javascript filename="gatsby-config.js"+module.exports = {+ plugins: [+ // ... other plugins+ {+ resolve: `gatsby-plugin-script`,+ options: {+ src: `https://app.rybbit.io/api/script.js`,+ async: true,+ defer: true,+ ['data-site-id']: `YOUR_SITE_ID`, // Replace with your Site ID+ // strategy: 'post-hydrate', // Or 'idle', 'off-main-thread'+ },+ },+ ],+};+```+The `onRenderBody` method is generally simpler for a basic async script like Rybbit's.++<Callout type="info">+ **Page View Tracking**: Gatsby sites behave like Single Page Applications (SPAs) after the initial load. Rybbit's tracking script is designed to automatically detect route changes (e.g., when using Gatsby's `<Link>` component) and track them as page views.++ If you find that page views are not being tracked correctly after client-side navigation, you might need to manually trigger page views. You can do this using the `onRouteUpdate` API in `gatsby-browser.js`:++ ```javascript filename="gatsby-browser.js"+ export const onRouteUpdate = ({ location, prevLocation }) => {+ if (typeof window !== 'undefined' && window.rybbit && location.pathname !== prevLocation?.pathname) {+ // Rybbit should auto-track, but if needed:+ // window.rybbit.trackPageview();+ console.log("Rybbit: Route updated to", location.pathname); // For debugging+ }+ };+ ```+ Create `gatsby-browser.js` at the root of your project if it doesn't exist. **Test the default behavior first**, as manual tracking might not be necessary.+</Callout>++## Custom Event Tracking++Since Gatsby uses React, you can track custom events from any of your React components.++**Example in a Gatsby component:**+```jsx+// src/components/MyInteractiveButton.js+import React from 'react';++const MyInteractiveButton = ({ buttonText, eventName, eventData }) => {+ const handleClick = () => {+ if (typeof window !== 'undefined' && window.rybbit) {+ window.rybbit.trackEvent(eventName || 'gatsby_button_click', eventData || {});+ }+ };++ return (+ <button onClick={handleClick}>+ {buttonText || "Click Me"}+ </button>+ );+};++export default MyInteractiveButton;+```+You can then use this component in your pages or other components:+```jsx+// src/pages/my-page.js+import React from "react"+import MyInteractiveButton from "../components/MyInteractiveButton"++const MyPage = () => (+ <div>+ <h1>Welcome to My Gatsby Page</h1>+ <MyInteractiveButton+ buttonText="Track Special Action"+ eventName="special_action_taken"+ eventData={{ pageContext: "my-page" }}+ />+ </div>+)++export default MyPage+```++Always ensure `window.rybbit` is available before calling its methods in client-side scripts.\ No newline at end of filediff --git a/docs/src/content/integrations/next-js.mdx b/docs/src/content/guides/react/next-js.mdxsimilarity index 61%rename from docs/src/content/integrations/next-js.mdxrename to docs/src/content/guides/react/next-js.mdxindex 7e15f6a97..0c0075bc1 100644--- a/docs/src/content/integrations/next-js.mdx+++ b/docs/src/content/guides/react/next-js.mdx@@ -114,3 +114,42 @@ and where you are using the script:```Note that this rewrite will consume the bandwidth of your server, as all tracking requests will be proxied through your Next.js application. Consider this when evaluating your hosting costs and server capacity requirements.+import { Callout } from "nextra/components"++<Callout type="info">+ **Page View Tracking in Next.js**: Rybbit's tracking script is designed to automatically detect route changes when using Next.js's `<Link>` component or `router.push()` and track them as page views. If you encounter a rare scenario where page views are not being tracked correctly after client-side navigation, you might need to manually trigger page views using `window.rybbit.trackPageview()`. However, test the default behavior first, as manual tracking is typically not necessary.+</Callout>++## Custom Event Tracking++Once the Rybbit script is loaded via the Next.js `Script` component, you can track custom events from any of your React components within your Next.js application.++```jsx+// Example in a Next.js component+// components/MyButton.js+'use client'; // If using App Router and this component has interactivity++// Declare rybbit on window for TypeScript if you're using it+// declare global {+// interface Window {+// rybbit?: {+// trackEvent: (eventName: string, eventData?: Record<string, any>) => void;+// trackPageview: () => void;+// // Add other methods if you use them+// };+// }+// }++export default function MyButton({ title }) {+ const handleClick = () => {+ if (typeof window !== 'undefined' && window.rybbit && typeof window.rybbit.trackEvent === 'function') {+ window.rybbit.trackEvent('button_click', { buttonTitle: title });+ } else {+ console.warn('Rybbit tracking not available.');+ }+ };++ return <button onClick={handleClick}>{title || 'Click Me'}</button>;+}+```+Always ensure `window.rybbit` and its methods are available before calling them, especially since the script loading is managed by Next.js's `strategy`. Consider the script's loading strategy (`afterInteractive` in the examples) when deciding where and how early you can reliably call these tracking functions.\ No newline at end of filediff --git a/docs/src/content/guides/react/remix.mdx b/docs/src/content/guides/react/remix.mdxnew file mode 100644index 000000000..8c2ebb920--- /dev/null+++ b/docs/src/content/guides/react/remix.mdx@@ -0,0 +1,101 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Remix++This guide explains how to integrate Rybbit with your Remix application for analytics tracking. Remix is a full-stack web framework that leverages React for building user interfaces.++## How to Add Rybbit to Your Remix App++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>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+></script>+```+Remember to replace `YOUR_SITE_ID` with your actual Site ID.++### 2. 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.++```tsx filename="app/root.tsx"+import {+ Links,+ Meta,+ Outlet,+ Scripts,+ ScrollRestoration,+} from "@remix-run/react";++export default function App() {+ const rybbitSiteId = "YOUR_SITE_ID"; // Replace with your actual Site ID++ return (+ <html lang="en">+ <head>+ <meta charSet="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <Meta />+ <Links />+ {/* Rybbit Tracking Snippet */}+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id={rybbitSiteId}+ async+ defer+ ></script>+ </head>+ <body>+ <Outlet />+ <ScrollRestoration />+ <Scripts />+ </body>+ </html>+ );+}+```+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.++### 3. 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.+</Steps>++<Callout type="info">+ **SPA Page View Tracking**: Rybbit's tracking script is designed to automatically detect route changes in most modern SPAs. Remix handles client-side navigation after the initial server render. If you find that page views are not being tracked correctly after client-side navigations (which can sometimes happen depending on the specifics of the script's SPA detection), you might need to manually trigger page views.++ One way to do this in Remix is to leverage a component that re-renders on navigation, or potentially by creating a custom `useLocationChange` hook if more granular control is needed, though this is often more complex. A simpler approach if manual tracking is needed might involve a root-level effect that listens to location changes. However, **test the default behavior first**, as manual tracking might not be necessary.+ If manual tracking is required, you would call `window.rybbit.trackPageview()` after a route change.+</Callout>++## Custom Event Tracking++Once the Rybbit script is installed and loaded, you can track custom events from any of your Remix route components or other React components within your Remix app:++```tsx+// Example in a Remix route component+export default function MyFeatureRoute() {+ const handleButtonClick = () => {+ if (typeof window !== "undefined" && window.rybbit) {+ window.rybbit.trackEvent('remix_feature_click', { feature: 'Special Offer' });+ }+ };++ return (+ <div>+ <h1>My Awesome Feature</h1>+ <button onClick={handleButtonClick}>Claim Offer</button>+ </div>+ );+}+```+Always check `typeof window !== "undefined"` before accessing `window.rybbit` because Remix components can render on the server. Then, ensure `window.rybbit` itself is available.\ No newline at end of filediff --git a/docs/src/content/guides/react/vite-cra.mdx b/docs/src/content/guides/react/vite-cra.mdxnew file mode 100644index 000000000..5f1c3d34a--- /dev/null+++ b/docs/src/content/guides/react/vite-cra.mdx@@ -0,0 +1,90 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# React (Vite / CRA)++This guide explains how to integrate Rybbit with your client-side React application, such as those created with Create React App (CRA) or Vite.++## How to Add Rybbit to Your React App++The recommended and simplest method to add the Rybbit tracking script is directly in your `index.html` file. This ensures the script is loaded early and reliably.++### Adding to `public/index.html` (or `index.html` for Vite)++This is the most straightforward method and ensures the script is loaded early.++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet. It will look like this:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```+Remember to replace `YOUR_SITE_ID` with your actual Site ID.++### 2. 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`.++### 3. 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.++```html filename="public/index.html (CRA) or index.html (Vite)"+<!DOCTYPE html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <!-- Example for CRA -->+ <!-- Other meta tags and links -->+ <title>My React App</title>+ <!-- Rybbit Tracking Snippet -->+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+ ></script>+ </head>+ <body>+ <noscript>You need to enable JavaScript to run this app.</noscript>+ <div id="root"></div>+ <!-- If you prefer, you can also place the script here, before </body> -->+ </body>+</html>+```+Make sure to replace `YOUR_SITE_ID` with your actual Site ID.++### 4. 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.+</Steps>++<Callout type="info">+ **SPA Page View Tracking**: Rybbit's tracking script is designed to automatically detect route changes in most modern SPAs (including those using React Router or similar libraries) and track them as page views. If you find that page views are not being tracked correctly after navigation, you might need to manually trigger page views using `window.rybbit.trackPageview()` after each route change. However, try the standard installation first.+</Callout>++## Custom Event Tracking++Once the script is installed, you can track custom events from any of your React components:++```jsx+function MyComponent() {+ const handleButtonClick = () => {+ if (window.rybbit) {+ window.rybbit.trackEvent('button_click', { category: 'CTA', label: 'Learn More' });+ }+ };++ return <button onClick={handleButtonClick}>Learn More</button>;+}+```++Ensure `window.rybbit` is available before calling its methods, especially if you load the script dynamically or have strict Content Security Policies.\ No newline at end of filediff --git a/docs/src/content/guides/shopify.mdx b/docs/src/content/guides/shopify.mdxnew file mode 100644index 000000000..bcf3dfe04--- /dev/null+++ b/docs/src/content/guides/shopify.mdx@@ -0,0 +1,206 @@+import { Steps } from "nextra/components"++# Shopify++Rybbit can be integrated with your Shopify store to capture events, track conversions, and analyze user behavior.++## How to Add Rybbit to Shopify++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet.++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```++### 2. Add the Snippet to Your Shopify Store++- In Shopify, go to **Online Store > Themes** and click **Edit code** from the settings dropdown beside the **Customize** button.+- Open `theme.liquid` in the **Layout** folder.+- Just before the closing `</head>` tag, insert your snippet.+- Save the file to apply the changes to your live store.++**Note:** If you are editing a theme you purchased or one that receives updates, be aware that theme updates might overwrite your changes, requiring you to re-add the snippet. While Shopify doesn't have a formal "child theme" system like WordPress, some developers use theme duplication or version control as a workaround. For most users, re-adding the snippet after an update is the simplest approach if this occurs.+</Steps>++## Tracking E-commerce Events++To get the most out of Rybbit with Shopify, you should track key e-commerce events. This typically involves adding small Liquid and JavaScript snippets to your theme files.++<Callout type="warning">+ Always back up your theme before making code changes. If you are not comfortable editing theme code, consider hiring a Shopify expert. The following snippets are examples and might need adjustments based on your specific theme structure and Shopify version.+</Callout>++### 1. View Product (`view_item`)++Track when a user views a single product page.++**Edit `product.liquid` (or your theme's main product template file, often found in `templates/product.liquid` or `sections/main-product.liquid` or similar):**++Add the following script towards the end of the file, or within a relevant product information block:++```liquid+{% raw %}{% comment %} Add to product.liquid or main product section {% endcomment %}+<script type="text/javascript">+ if (typeof window.rybbit !== 'undefined' && {{ product | json }}) {+ const rybbitProduct = {{ product | json }};+ const rybbitCurrentVariant = {{ product.selected_or_first_available_variant | json }};++ window.rybbit.trackEvent('view_item', {+ item_id: rybbitCurrentVariant.sku || rybbitCurrentVariant.id,+ item_name: rybbitProduct.title,+ item_variant: rybbitCurrentVariant.title === 'Default Title' ? null : rybbitCurrentVariant.title,+ price: parseFloat(rybbitCurrentVariant.price) / 100, // Price is in cents+ currency: {{ cart.currency.iso_code | json }}+ });+ }+</script>{% endraw %}+```++### 2. Add to Cart (`add_to_cart`)++Tracking "add to cart" events can be complex due to themes using AJAX for cart updates. Here's a common approach by attaching an event listener to your "Add to Cart" button.++**Identify your "Add to Cart" button/form in `product.liquid` or your product form section.**++You'll need to add a script that listens for clicks or form submissions. This example assumes your "Add to Cart" button has an ID like `add-to-cart-button` or is part of a form with a specific class or ID. You may need to adjust the selector.++```liquid+{% raw %}{% comment %} Add near your product form or Add to Cart button in product.liquid/product form section {% endcomment %}+<script type="text/javascript">+document.addEventListener('DOMContentLoaded', function() {+ const addToCartForm = document.querySelector('form[action="/cart/add"]'); // Common selector for product forms+ const addToCartButton = document.getElementById('add-to-cart-button') || addToCartForm?.querySelector('[type="submit"]');++ const trackAddToCart = function() {+ if (typeof window.rybbit !== 'undefined' && {{ product | json }}) {+ const rybbitProduct = {{ product | json }};+ const rybbitCurrentVariant = {{ product.selected_or_first_available_variant | json }};+ let quantity = 1;+ const quantityInput = addToCartForm?.querySelector('[name="quantity"], input[type="number"]'); // Common quantity input selectors+ if (quantityInput && quantityInput.value) {+ quantity = parseInt(quantityInput.value, 10);+ }++ window.rybbit.trackEvent('add_to_cart', {+ item_id: rybbitCurrentVariant.sku || rybbitCurrentVariant.id,+ item_name: rybbitProduct.title,+ item_variant: rybbitCurrentVariant.title === 'Default Title' ? null : rybbitCurrentVariant.title,+ price: parseFloat(rybbitCurrentVariant.price) / 100,+ currency: {{ cart.currency.iso_code | json }},+ quantity: quantity > 0 ? quantity : 1+ });+ }+ };++ if (addToCartButton) {+ addToCartButton.addEventListener('click', function(event) {+ // Delay slightly to allow form submission/validation if needed, or track on form submit+ // For themes with AJAX add to cart, this might need to hook into the theme's specific JS events.+ setTimeout(trackAddToCart, 100); // Basic click tracking+ });+ } else if (addToCartForm) {+ addToCartForm.addEventListener('submit', function(event) {+ trackAddToCart(); // Track on form submission+ });+ }+});+</script>{% endraw %}+```+<Callout type="info">+ For themes with AJAX "Add to Cart" functionality (where the page doesn't reload), you might need to listen for custom JavaScript events fired by your theme after an item is successfully added to the cart, or observe changes to the cart. This can be theme-specific.+</Callout>++### 3. Begin Checkout (`begin_checkout`)++Shopify's checkout process is on a separate domain (`checkout.shopify.com`), and direct script injection into the checkout pages (beyond the "Order status" page) is limited for most plans. However, Rybbit's script, if loaded on your main store, should persist session information.++A common way to track "begin_checkout" is by tracking clicks on checkout buttons.++**Edit `cart.liquid` (or your theme's main cart template, often `templates/cart.liquid` or `sections/main-cart-items.liquid`):**++Find your "Checkout" button and add an ID to it if it doesn't have one (e.g., `id="checkout-button"`). Then add this script:++```liquid+{% raw %}{% comment %} Add to cart.liquid, near the checkout button logic {% endcomment %}+<script type="text/javascript">+document.addEventListener('DOMContentLoaded', function() {+ const checkoutButton = document.getElementById('checkout-button') || document.querySelector('[name="checkout"], form[action$="/checkout"] [type="submit"]'); // Common selectors++ if (checkoutButton && typeof window.rybbit !== 'undefined' && {{ cart | json }}) {+ checkoutButton.addEventListener('click', function() {+ const rybbitCart = {{ cart | json }};+ let items = [];+ rybbitCart.items.forEach(function(item) {+ items.push({+ item_id: item.sku || item.variant_id,+ item_name: item.product_title,+ item_variant: item.variant_title === 'Default Title' ? null : item.variant_title,+ price: parseFloat(item.final_price) / 100,+ quantity: item.quantity+ });+ });++ window.rybbit.trackEvent('begin_checkout', {+ currency: rybbitCart.currency,+ value: parseFloat(rybbitCart.total_price) / 100,+ items: items+ });+ });+ }+});+</script>{% endraw %}+```++### 4. Purchase (`purchase`)++Track completed purchases on the Shopify "Order status" page (also known as the "Thank You" page).++**Go to Shopify Admin > Settings > Checkout.**+Scroll down to the **Order status page** section. In the **Additional scripts** box, paste the following:++```liquid+{% raw %}{% if first_time_accessed %}+<script type="text/javascript">+ if (typeof window.rybbit !== 'undefined' && {{ checkout | json }}) {+ const rybbitCheckout = {{ checkout | json }};+ let items = [];+ rybbitCheckout.line_items.forEach(function(item) {+ items.push({+ item_id: item.sku || item.variant_id,+ item_name: item.product.title, // Access product title via item.product+ item_variant: item.variant_title === 'Default Title' ? null : item.variant_title,+ price: parseFloat(item.price), // item.price should be line item price+ quantity: item.quantity+ });+ });++ window.rybbit.trackEvent('purchase', {+ transaction_id: rybbitCheckout.order_number,+ value: parseFloat(rybbitCheckout.total_price),+ tax: parseFloat(rybbitCheckout.tax_price),+ shipping: parseFloat(rybbitCheckout.shipping_price),+ currency: rybbitCheckout.currency,+ items: items+ });+ }+</script>+{% endif %}{% endraw %}+```+**Explanation:**+- `{% raw %}{% if first_time_accessed %}{% endraw %}`: Ensures the script runs only once when the order status page is first loaded, preventing duplicate tracking on page refresh.+- `{{ checkout | json }}`: Provides access to checkout and order data.++## Important Considerations+* **Theme Differences**: Shopify themes can vary significantly. You may need to adjust Liquid object paths (e.g., `product.selected_or_first_available_variant` vs. `current_variant`) and JavaScript selectors based on your specific theme's structure.+* **Currency Conversion**: Prices in Shopify Liquid objects are often in cents. Ensure you divide by 100 to get the decimal value for Rybbit.+* **AJAX Carts**: If your theme uses an AJAX cart (drawer or pop-up cart that updates without page reload), tracking `add_to_cart` accurately requires hooking into your theme's specific JavaScript events or using MutationObserver to detect cart changes. The provided `add_to_cart` example is a basic starting point.+* **Shopify Customer Events**: For more robust server-side or client-side event tracking, especially for `add_to_cart` and `begin_checkout` without relying on DOM manipulation, explore [Shopify Customer Events](https://shopify.dev/docs/api/customer-events). This allows you to subscribe to events like "product added to cart" or "checkout started" and send data to Rybbit via a custom pixel or by triggering client-side JavaScript. This is a more advanced but often more reliable method.+* **Testing**: Thoroughly test each event in your Rybbit dashboard after implementation. Use your browser's developer console to check for JavaScript errors.diff --git a/docs/src/content/guides/squarespace.mdx b/docs/src/content/guides/squarespace.mdxnew file mode 100644index 000000000..7d067924d--- /dev/null+++ b/docs/src/content/guides/squarespace.mdx@@ -0,0 +1,56 @@+import { Callout } from 'nextra/components'++# Squarespace++Integrating Rybbit Analytics with your Squarespace website is straightforward. You'll need to use Squarespace's "Code Injection" feature to add the Rybbit tracking script to your site.++## 1. Get Your Tracking Script++First, you'll need your Rybbit tracking script. You can find this in your Rybbit dashboard under **Site Settings > Tracking Code**. It will look something like this:++```html+<script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+```++Replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.++## 2. Go to Squarespace Settings++Log in to your Squarespace account and go to the website you want to track.++From the main dashboard (Home Menu), navigate to:++- **Settings**++## 3. Access Code Injection++In the Settings panel, find and click on:++- **Website** (under the "GENERAL" section)+- Then, click on **Code Injection** (under the "ADVANCED" or "DEVELOPER" section, depending on your Squarespace version).++<Callout type="info">+ The Code Injection feature is available on Squarespace Business and Commerce plans. It may not be available on Personal plans.+</Callout>++## 4. Paste Your Tracking Script++In the Code Injection settings, you'll see several fields (Header, Footer, Lock Page, Order Confirmation Page).++For sitewide tracking, paste your Rybbit tracking script into the **Footer** text area. This ensures the script loads after your page content, which is generally better for perceived page load performance.++Alternatively, you can place it in the **Header**, which might track users who leave before the page fully loads, but could slightly impact initial page load speed. For most analytics purposes, the Footer is recommended.++## 5. Save Changes++After pasting the script, click the **Save** button at the top of the Code Injection panel.++## 6. Verify Integration++Once you've saved the changes, Rybbit Analytics should start tracking visitors on your Squarespace site.++- Open your Squarespace website in a new browser tab or incognito window.+- Navigate through a few pages.+- Check your Rybbit dashboard for incoming data. It might take a few minutes for the first events to appear.++That's it! Rybbit Analytics is now integrated with your Squarespace website.\ No newline at end of filediff --git a/docs/src/content/guides/svelte/sveltekit.mdx b/docs/src/content/guides/svelte/sveltekit.mdxnew file mode 100644index 000000000..f83b5265c--- /dev/null+++ b/docs/src/content/guides/svelte/sveltekit.mdx@@ -0,0 +1,95 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# SvelteKit++This guide explains how to integrate Rybbit with your SvelteKit application for analytics tracking.++## How to Add Rybbit to Your SvelteKit App++The recommended and most straightforward method for SvelteKit is to add the Rybbit tracking script directly to your `src/app.html` file. This ensures the script is loaded early on all pages.++### Adding to `src/app.html`++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```+Replace `YOUR_SITE_ID` with your actual Site ID.++### 2. Locate Your `app.html` File++In a SvelteKit project, this file is typically located at `src/app.html`.++### 3. 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.++```html filename="src/app.html"+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <link rel="icon" href="%sveltekit.assets%/favicon.png" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <!-- Rybbit Tracking Snippet -->+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+ ></script>+ %sveltekit.head%+ </head>+ <body data-sveltekit-preload-data="hover">+ <div style="display: contents">%sveltekit.body%</div>+ </body>+</html>+```+Ensure `YOUR_SITE_ID` is replaced.++### 4. Verify Installation++Deploy your application and check your Rybbit dashboard for incoming data.+</Steps>++<Callout type="info">+ **SPA Page View Tracking**: Rybbit's script is designed to automatically track route changes in SvelteKit applications. If page views aren't tracked correctly after navigation (which is uncommon), you might need to manually trigger them using the `afterNavigate` lifecycle function:+ ```svelte+ // In a layout or page component+ import { afterNavigate } from '$app/navigation';++ afterNavigate(() => {+ if (typeof window !== 'undefined' && window.rybbit) {+ window.rybbit.trackPageview();+ }+ });+ ```+ Test the default behavior first.+</Callout>++## Custom Event Tracking++From any Svelte component within your SvelteKit app, you can track custom events:++```svelte+<script>+ function handleAction() {+ if (typeof window !== 'undefined' && window.rybbit) {+ window.rybbit.trackEvent('user_action_sveltekit', { component: 'MySvelteKitComponent' });+ }+ }+</script>++<button on:click={handleAction}>Perform SvelteKit Action</button>+```+Always check `typeof window !== 'undefined'` before accessing `window.rybbit` as SvelteKit components can also run on the server.\ No newline at end of filediff --git a/docs/src/content/guides/svelte/vite.mdx b/docs/src/content/guides/svelte/vite.mdxnew file mode 100644index 000000000..05e2b20ac--- /dev/null+++ b/docs/src/content/guides/svelte/vite.mdx@@ -0,0 +1,85 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Svelte (Vite / Client-Side)++This guide explains how to integrate Rybbit with your standard client-side Svelte applications, typically built using Vite (e.g., via `npm create vite@latest -- --template svelte`).++## How to Add Rybbit to Your Client-Side Svelte App++The most straightforward method is to add the Rybbit tracking script directly to your `index.html` file.++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```+Replace `YOUR_SITE_ID` with your actual Site ID.++### 2. Locate Your `index.html` File++For Vite-based Svelte projects, this file is typically located at the root of your project as `index.html`.++### 3. Add the Snippet to `index.html`++Open `index.html` and paste the Rybbit tracking snippet just before the closing `</head>` tag or `</body>` tag.++```html filename="index.html (Vite)"+<!DOCTYPE html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <link rel="icon" type="image/svg+xml" href="/vite.svg" /> <!-- Or your favicon -->+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>My Svelte App</title>+ <!-- Rybbit Tracking Snippet -->+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+ ></script>+ </head>+ <body>+ <div id="app"></div>+ <script type="module" src="/src/main.js"></script> <!-- Or main.ts -->+ <!-- Or place script here, before </body> -->+ </body>+</html>+```+Ensure `YOUR_SITE_ID` is replaced.++### 4. 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.+</Steps>++<Callout type="info">+ **SPA Page View Tracking**: Rybbit's script is designed to automatically track route changes in client-side Svelte SPAs using common routers (like `svelte-routing` or `svelte-spa-router`). If page views aren't tracked correctly after navigation, you might need to manually trigger `window.rybbit.trackPageview()` after each route change, using your router's specific API for navigation events.+</Callout>++## Custom Event Tracking++From any Svelte component, you can track custom events:++```svelte+<script>+ function handleClientAction() {+ // Ensure running in browser, though for client-side Svelte this is usually the case+ if (typeof window !== 'undefined' && window.rybbit) {+ window.rybbit.trackEvent('user_action_svelte_vite', { component: 'MySvelteViteComponent' });+ }+ }+</script>++<button on:click={handleClientAction}>Perform Client Svelte Action</button>+```+Always check for `window.rybbit` before calling its methods.\ No newline at end of filediff --git a/docs/src/content/guides/vue/nuxt.mdx b/docs/src/content/guides/vue/nuxt.mdxnew file mode 100644index 000000000..557d55a75--- /dev/null+++ b/docs/src/content/guides/vue/nuxt.mdx@@ -0,0 +1,89 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Nuxt.js++This guide explains how to integrate Rybbit with your Nuxt.js application for analytics tracking. Nuxt.js provides a structured way to add external scripts via its configuration.++## Adding Rybbit via Nuxt.js Configuration++This is the recommended method for Nuxt.js applications.++<Steps>+### 1. 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.++### 2. Modify `nuxt.config.ts` (or `.js`)++**For Nuxt 3:**++Add the Rybbit script to the `app.head.script` array in your `nuxt.config.ts` file:++```typescript filename="nuxt.config.ts"+export default defineNuxtConfig({+ // ... other configurations+ app: {+ head: {+ script: [+ {+ src: 'https://app.rybbit.io/api/script.js',+ async: true,+ defer: true,+ 'data-site-id': 'YOUR_SITE_ID', // Replace with your Site ID+ },+ ],+ },+ },+})+```++**For Nuxt 2:**++Add the Rybbit script to the `head.script` array in your `nuxt.config.js` file:++```javascript filename="nuxt.config.js"+export default {+ // ... other configurations+ head: {+ // ... other head properties+ script: [+ {+ src: 'https://app.rybbit.io/api/script.js',+ async: true,+ defer: true,+ 'data-site-id': 'YOUR_SITE_ID', // Replace with your Site ID+ },+ ],+ },+}+```+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.++### 3. 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.+</Steps>++<Callout type="info">+ **SPA Page View Tracking**: Rybbit's tracking script is designed to automatically detect route changes in Nuxt.js applications and track them as page views. If you find that page views are not being tracked correctly after navigation (which is uncommon for Nuxt), you might need to manually trigger page views using `window.rybbit.trackPageview()` after each route change. You could use Nuxt's router events or middleware for this if necessary, but test the default behavior first.+</Callout>++## Custom Event Tracking++From any Vue component within your Nuxt.js application, you can track custom events:++```vue+<template>+ <button @click="trackCustomEvent">Track Important Action</button>+</template>++<script setup>+function trackCustomEvent() {+ if (process.client && window.rybbit) { // Ensure running on client and rybbit exists+ window.rybbit.trackEvent('nuxt_interaction', { detail: 'User clicked important button' });+ }+}+</script>+```+Using `process.client` (Nuxt 2) or checking `typeof window !== 'undefined'` (Nuxt 3, or generally) is good practice before accessing `window` if your component might render or execute logic on the server side.\ No newline at end of filediff --git a/docs/src/content/guides/vue/vite.mdx b/docs/src/content/guides/vue/vite.mdxnew file mode 100644index 000000000..911e793d0--- /dev/null+++ b/docs/src/content/guides/vue/vite.mdx@@ -0,0 +1,107 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# Vue.js (Vite / Client-Side)++This guide explains how to integrate Rybbit with your standard client-side Vue.js Single Page Applications (SPAs), typically built using Vite (e.g., via `npm create vue@latest` or `npm create vite@latest -- --template vue`).++## How to Add Rybbit to Your Client-Side Vue.js App++The recommended and simplest method for client-side Vue applications is to add the Rybbit tracking script directly to your `index.html` file. This ensures the script is loaded early and reliably.++### Adding to `index.html`++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet:++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```+Replace `YOUR_SITE_ID` with your actual Site ID.++### 2. Locate Your `index.html` File++This file is typically located at the root of your Vite-based Vue project.++### 3. 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.++```html filename="index.html (Vite)"+<!DOCTYPE html>+<html lang="en">+ <head>+ <meta charset="UTF-8">+ <link rel="icon" href="/favicon.ico">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>My Vue App</title>+ <!-- Rybbit Tracking Snippet -->+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+ ></script>+ </head>+ <body>+ <div id="app"></div>+ <script type="module" src="/src/main.js"></script>+ <!-- Or place script here, before </body> -->+ </body>+</html>+```+Ensure `YOUR_SITE_ID` is replaced with your actual Site ID.++### 4. 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.+</Steps>++<Callout type="info">+ **SPA Page View Tracking**: Rybbit's script is designed to automatically track route changes in SPAs using Vue Router. If page views aren't tracked correctly after navigation, you might need to manually trigger them using `window.rybbit.trackPageview()` after each route change. This can be done using Vue Router's navigation guards:+ ```javascript+ // Example with Vue Router in your router setup file (e.g., src/router/index.js)+ import { createRouter, createWebHistory } from 'vue-router';+ // ... your routes ...++ const router = createRouter({+ history: createWebHistory(import.meta.env.BASE_URL),+ routes: [ /* ... your routes ... */ ]+ });++ router.afterEach((to, from) => {+ if (window.rybbit && typeof window.rybbit.trackPageview === 'function') {+ window.rybbit.trackPageview();+ }+ });++ export default router;+ ```+ Always test the default behavior first, as manual tracking might not be necessary.+</Callout>++## Custom Event Tracking++From any Vue component or method, you can track custom events:++```vue+<template>+ <button @click="trackCustomEvent">Track Action</button>+</template>++<script setup>+function trackCustomEvent() {+ if (window.rybbit && typeof window.rybbit.trackEvent === 'function') {+ window.rybbit.trackEvent('custom_vue_action', { detail: 'User performed a client-side Vue action' });+ }+}+</script>+```+Always check if `window.rybbit` and its methods are available before calling them.\ No newline at end of filediff --git a/docs/src/content/guides/webflow.mdx b/docs/src/content/guides/webflow.mdxnew file mode 100644index 000000000..907e3978d--- /dev/null+++ b/docs/src/content/guides/webflow.mdx@@ -0,0 +1,107 @@+import { Steps } from "nextra/components"++# Webflow++Rybbit enables you to collect analytics, capture custom events, and more on your Webflow site.++## How to Add Rybbit to Webflow++<Steps>+### 1. Retrieve Your Tracking Script++Navigate to your Rybbit dashboard to obtain your code snippet.++```html+<script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+></script>+```++### 2. Add the Snippet to Your Webflow Project++- In your Webflow project, go to **Site settings > Custom code**.+- Paste your snippet into the **Head code** section.+- Save and publish your changes.+</Steps>++import { Callout } from "nextra/components"++<Callout type="info">+ **Page View Tracking in Webflow**:+ - **Standard Navigation**: For standard page-to-page navigation in Webflow, Rybbit will track each new page load automatically.+ - **Interactions & Animations**: If you use Webflow interactions that change content significantly without changing the URL (e.g., showing/hiding sections to simulate tabs or multi-step forms on a single page), Rybbit will only track the initial page load. For these "virtual" page views, you would need to use custom event tracking to mark those interactions.+ - **Single-Page Sites**: If your Webflow site is a single-page design with sections, only one page view will be tracked unless you implement custom event tracking for section views.+</Callout>++## Custom Event Tracking in Webflow++You can track custom events in Webflow by adding custom JavaScript code, either in the **Custom Code** section of your site settings (for global scripts) or within an **Embed** element on a specific page.++**Example: Tracking a button click**++1. **Give your button an ID:**+ * Select the button element in the Webflow Designer.+ * Go to the **Settings** panel (cog icon).+ * Under **General**, set a unique **ID** for the button (e.g., `my-special-button`).++2. **Add Custom JavaScript:**+ You can add this script in **Site Settings > Custom Code > Footer Code** to make it available globally, or in an Embed element on the page where the button exists.++ ```html+ <script type="text/javascript">+ document.addEventListener('DOMContentLoaded', function() {+ var specialButton = document.getElementById('my-special-button');+ if (specialButton) {+ specialButton.addEventListener('click', function() {+ if (typeof window.rybbit !== 'undefined') {+ window.rybbit.trackEvent('webflow_button_click', {+ button_id: 'my-special-button',+ button_text: specialButton.textContent || specialButton.innerText,+ page_path: window.location.pathname+ });+ }+ });+ }+ });+ </script>+ ```++**Example: Tracking a form submission**++1. **Give your form an ID:**+ * Select the Form Block element.+ * Go to the **Settings** panel.+ * Set a unique **ID** (e.g., `contact-form`).++2. **Add Custom JavaScript (in Footer Code or Embed):**++ ```html+ <script type="text/javascript">+ document.addEventListener('DOMContentLoaded', function() {+ var contactForm = document.getElementById('contact-form');+ if (contactForm) {+ contactForm.addEventListener('submit', function() {+ // It's often good to track *after* successful submission if Webflow provides a callback.+ // For a simple submit click, this is how you'd do it.+ // For Webflow's native form handling, you might need to hook into its success state if possible,+ // or track the click on the submit button itself.+ if (typeof window.rybbit !== 'undefined') {+ window.rybbit.trackEvent('webflow_form_submit', {+ form_id: 'contact-form',+ // You can try to get form field values here if needed, but be mindful of PII.+ });+ }+ });+ }+ });+ </script>+ ```++<Callout type="warning">+ When adding custom JavaScript in Webflow, ensure it's placed correctly (usually in the Footer Code for scripts that need the DOM to be ready) and test thoroughly. Webflow's own interactions might sometimes conflict or require specific timing for custom scripts.+</Callout>++By using these methods, you can enhance Rybbit's tracking on your Webflow site beyond basic page views.diff --git a/docs/src/content/guides/wix.mdx b/docs/src/content/guides/wix.mdxnew file mode 100644index 000000000..cf2ea6d3b--- /dev/null+++ b/docs/src/content/guides/wix.mdx@@ -0,0 +1,65 @@+import { Callout } from 'nextra/components'++# Wix++Integrating Rybbit Analytics with your Wix website involves adding a custom code snippet to your site's tracking tools.++## 1. Get Your Tracking Script++First, you'll need your Rybbit tracking script. You can find this in your Rybbit dashboard under **Site Settings > Tracking Code**. It will look something like this:++```html+<script async defer src="https://app.rybbit.io/api/script.js" data-site-id="YOUR_SITE_ID"></script>+```++Replace `YOUR_SITE_ID` with your actual Site ID from your Rybbit dashboard.++## 2. Go to Wix Dashboard++Log in to your Wix account and select the site you want to track.++From your site's dashboard, navigate to:++- **Settings** (usually in the left-hand sidebar)++## 3. Access Tracking Tools / Custom Code++In the Settings menu, look for a section related to tracking or advanced settings. This is often called:++- **Tracking Tools & Analytics** (under "Marketing & SEO" or a similar category)+- Or, **Custom Code** (sometimes under "Advanced Settings")++<Callout type="info">+ To add custom code, you'll need a Wix Premium plan and a connected domain. This feature is typically not available on free Wix plans.+</Callout>++## 4. Add New Custom Code++Once in the Tracking Tools or Custom Code section:++- Click on **+ New Tool** or **+ Add Custom Code**.+- Choose **Custom** from the list of options if prompted.++## 5. Configure the Custom Code++You'll be presented with a form to add your code:++- **Paste your Rybbit tracking script** into the main code snippet box.+- **Name your code:** Give it a recognizable name, like "Rybbit Analytics".+- **Add Code to Pages:** Select **All pages** to track your entire site.+ - You might have an option to **Load code once** or **Load code on each new page**. Choose the option that best reflects loading the script on every page view.+- **Place Code in:** Choose **Body - end**. This is generally recommended for analytics scripts to avoid impacting perceived page load speed. Some Wix versions might offer "Head" or "Body - start" as well. "Body - end" is usually the best choice.++## 6. Apply Changes++Click **Apply** or **Save** to add the custom code to your site.++## 7. Verify Integration++After applying the changes, Rybbit Analytics should start tracking visitors on your Wix site.++- Open your Wix website in a new browser tab or incognito window.+- Navigate through a few pages.+- Check your Rybbit dashboard for incoming data. It might take a few minutes for the first events to appear.++That's it! Rybbit Analytics is now integrated with your Wix website.\ No newline at end of filediff --git a/docs/src/content/guides/woocommerce.mdx b/docs/src/content/guides/woocommerce.mdxnew file mode 100644index 000000000..acb5dfb21--- /dev/null+++ b/docs/src/content/guides/woocommerce.mdx@@ -0,0 +1,216 @@+import { Steps } from "nextra/components"+import { Callout } from "nextra/components"++# WooCommerce++This guide explains how to integrate Rybbit with your WooCommerce store (running on WordPress) to track e-commerce events like product views, add to carts, and purchases, in addition to standard page view analytics.++## Prerequisites++1. **Rybbit Installed on WordPress**: Ensure you have already installed the Rybbit tracking script on your WordPress site using one of the methods described in our [WordPress integration guide](./wordpress). This guide focuses on adding e-commerce event tracking.+2. **Access to `functions.php` or Custom Plugin**: You'll need to add PHP snippets. The recommended way is via your child theme's `functions.php` file or a custom plugin to avoid changes being overwritten by theme updates.++## Tracking E-commerce Events++WooCommerce provides various action hooks that allow you to trigger JavaScript when specific e-commerce events occur. We'll use these to send data to Rybbit.++<Callout type="warning">+ The following PHP code snippets should be added to your **child theme's `functions.php` file** or a **custom site-specific plugin**. Modifying your parent theme's `functions.php` directly is not recommended as changes will be lost upon theme updates.+</Callout>++### 1. View Product (`view_item`)++Track when a user views a single product page.++```php+// Add to your child theme's functions.php or a custom plugin+add_action( 'woocommerce_after_single_product_summary', 'rybbit_track_view_product', 10 );+function rybbit_track_view_product() {+ if ( ! is_product() ) { // Ensure it's a single product page+ return;+ }++ global $product;+ if ( ! $product instanceof WC_Product ) {+ return;+ }++ $product_data = array(+ 'item_id' => $product->get_sku() ? $product->get_sku() : $product->get_id(),+ 'item_name' => $product->get_name(),+ 'price' => (float) $product->get_price(),+ 'currency' => get_woocommerce_currency(),+ );+ ?>+ <script type="text/javascript">+ if (typeof window.rybbit !== 'undefined') {+ window.rybbit.trackEvent('view_item', <?php echo json_encode($product_data); ?>);+ }+ </script>+ <?php+}+```++### 2. Add to Cart (`add_to_cart`)++Track when a user adds a product to their cart. This example uses a JavaScript approach triggered after the "Add to Cart" button on single product pages. For AJAX add-to-carts (e.g., on archive pages), a JavaScript event listener on `$(document.body).on('added_to_cart', ...)` might be more robust.++```php+// Add to your child theme's functions.php or a custom plugin+add_action( 'woocommerce_after_add_to_cart_button', 'rybbit_track_add_to_cart_script' );+function rybbit_track_add_to_cart_script() {+ global $product;+ if ( ! $product instanceof WC_Product ) {+ return;+ }++ $product_data = array(+ 'item_id' => $product->get_sku() ? $product->get_sku() : $product->get_id(),+ 'item_name' => $product->get_name(),+ 'price' => (float) $product->get_price(),+ 'currency' => get_woocommerce_currency(),+ // Quantity is typically 1 here, but can be dynamic if your theme supports it before this hook+ );+ ?>+ <script type="text/javascript">+ document.addEventListener('DOMContentLoaded', function() {+ const form = document.querySelector('form.cart');+ if (form) {+ form.addEventListener('submit', function() {+ // Attempt to get quantity, default to 1+ let quantity = 1;+ const quantityInput = form.querySelector('input.qty');+ if (quantityInput && quantityInput.value) {+ quantity = parseInt(quantityInput.value, 10);+ }++ if (typeof window.rybbit !== 'undefined') {+ const eventData = <?php echo json_encode($product_data); ?>;+ eventData.quantity = quantity > 0 ? quantity : 1;+ window.rybbit.trackEvent('add_to_cart', eventData);+ }+ });+ }+ });+ </script>+ <?php+}++// For AJAX add to cart events (e.g., on shop/category pages)+add_action( 'wp_footer', 'rybbit_ajax_add_to_cart_tracker' );+function rybbit_ajax_add_to_cart_tracker() {+ if ( is_admin() ) return;+ ?>+ <script type="text/javascript">+ jQuery(document.body).on('added_to_cart', function(event, fragments, cart_hash, $button) {+ if (typeof window.rybbit !== 'undefined' && $button && $button.length) {+ const productId = $button.data('product_id');+ const quantity = $button.data('quantity') || 1; // Or $button.closest('.product').find('input.qty').val()+ // Note: Getting full product details here via AJAX might be needed for price, name, SKU+ // This example sends basic info. For more details, you might need another AJAX call or pass data via $button.data attributes+ window.rybbit.trackEvent('add_to_cart', {+ item_id: productId,+ quantity: quantity,+ source: 'ajax_add_to_cart'+ // Consider adding more product details if readily available or via a separate AJAX call+ });+ }+ });+ </script>+ <?php+}+```++### 3. Begin Checkout (`begin_checkout`)++Track when a user proceeds to the checkout page.++```php+// Add to your child theme's functions.php or a custom plugin+add_action( 'woocommerce_before_checkout_form', 'rybbit_track_begin_checkout', 5 );+function rybbit_track_begin_checkout() {+ if ( is_admin() || ! is_checkout() ) return;++ $cart = WC()->cart;+ if ( ! $cart ) return;++ $items = [];+ foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {+ $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );+ $items[] = array(+ 'item_id' => $_product->get_sku() ? $_product->get_sku() : $_product->get_id(),+ 'item_name' => $_product->get_name(),+ 'price' => (float) $_product->get_price(),+ 'quantity' => (int) $cart_item['quantity'],+ );+ }++ $checkout_data = array(+ 'currency' => get_woocommerce_currency(),+ 'value' => (float) $cart->get_total( 'edit' ), // Get total without formatting+ 'items' => $items,+ );+ ?>+ <script type="text/javascript">+ if (typeof window.rybbit !== 'undefined') {+ window.rybbit.trackEvent('begin_checkout', <?php echo json_encode($checkout_data); ?>);+ }+ </script>+ <?php+}+```++### 4. Purchase (`purchase`)++Track when a purchase is completed (on the "Thank You" page).++```php+// Add to your child theme's functions.php or a custom plugin+add_action( 'woocommerce_thankyou', 'rybbit_track_purchase', 10, 1 );+function rybbit_track_purchase( $order_id ) {+ if ( ! $order_id ) {+ return;+ }+ $order = wc_get_order( $order_id );+ if ( ! $order ) {+ return;+ }++ $items = [];+ foreach ( $order->get_items() as $item_id => $item ) {+ $product = $item->get_product();+ $items[] = array(+ 'item_id' => $product ? ($product->get_sku() ? $product->get_sku() : $product->get_id()) : $item->get_product_id(),+ 'item_name' => $item->get_name(),+ 'price' => (float) $order->get_line_subtotal( $item, false, false ), // Price for the line item+ 'quantity' => (int) $item->get_quantity(),+ );+ }++ $purchase_data = array(+ 'transaction_id' => $order->get_order_number(),+ 'value' => (float) $order->get_total(),+ 'tax' => (float) $order->get_total_tax(),+ 'shipping' => (float) $order->get_shipping_total(),+ 'currency' => $order->get_currency(),+ 'items' => $items,+ );+ ?>+ <script type="text/javascript">+ if (typeof window.rybbit !== 'undefined') {+ window.rybbit.trackEvent('purchase', <?php echo json_encode($purchase_data); ?>);+ }+ </script>+ <?php+}+```++## Important Considerations++* **Script Loading Order**: Ensure the main Rybbit tracking script (added via the WordPress integration guide) is loaded before these event-specific scripts attempt to call `window.rybbit`. Placing the main script in the `<head>` usually ensures this.+* **Data Accuracy**: The product data (SKU, name, price) retrieved in these examples depends on your WooCommerce setup and product configuration. Test thoroughly.+* **AJAX Operations**: For themes or plugins that use AJAX heavily (e.g., AJAX add to cart, mini-cart updates), you might need more sophisticated JavaScript event listeners rather than relying solely on PHP action hooks that fire on page load. The AJAX add-to-cart example provides a starting point.+* **Performance**: While these snippets are generally lightweight, outputting many inline scripts can have a minor impact. For very high-traffic sites, consider consolidating JavaScript or using more advanced techniques if performance becomes a concern.+* **Plugin Conflicts**: Test for conflicts if you are using other analytics or tracking plugins.++By implementing these tracking snippets, you can gain valuable insights into your WooCommerce store's performance using Rybbit.\ No newline at end of filediff --git a/docs/src/content/guides/wordpress.mdx b/docs/src/content/guides/wordpress.mdxnew file mode 100644index 000000000..73d3e1dd2--- /dev/null+++ b/docs/src/content/guides/wordpress.mdx@@ -0,0 +1,75 @@+import { Tabs } from 'nextra/components'+import { Steps } from 'nextra/components' // Keep Steps if used within tabs++# WordPress++You can integrate Rybbit into your WordPress site to track user behavior and gather analytics. There are several ways to do this depending on whether you're using a hosted WordPress.com site or a self-hosted WordPress.org installation.++<Tabs items={['Rybbit Plugin', 'Insert Headers & Footers Plugin', 'Add to functions.php', 'Modify header.php']}>+ <Tabs.Tab>+ **Rybbit WordPress Plugin (Recommended for ease of use)**++ You can find our community-maintained WordPress plugin as well as installation instructions [here](https://github.com/didyouexpectthat/rybbit-analytics-tracking-code). This is often the simplest method for most users.+ </Tabs.Tab>+ <Tabs.Tab>+ **Insert Headers and Footers Plugin (Good for WordPress.com or no-code approach)**++ If you don't want to modify your theme files directly, or if you are using WordPress.com (where direct theme editing is restricted), you can use a plugin to inject the Rybbit snippet.++ 1. Install the [Insert Headers and Footers](https://wordpress.com/plugins/insert-headers-and-footers) plugin (or a similar plugin that allows adding scripts to the header).+ 2. Go to the plugin settings (often found under **Settings > Insert Headers and Footers**).+ 3. Paste your Rybbit tracking snippet into the section designated for scripts in the header.+ ```html+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID"+ async+ defer+ ></script>+ ```+ 4. Save your changes.+ </Tabs.Tab>+ <Tabs.Tab>+ **Add to `functions.php` (For self-hosted WordPress with child theme)**++ If you're using a self-hosted WordPress theme, you can add the script via `functions.php`. It is **strongly recommended to make these changes in a child theme**. If you modify the parent theme files directly, your changes may be lost when the theme is updated.++ 1. In your WordPress dashboard, go to **Appearance > Theme File Editor**. (Alternatively, edit the file via FTP/SFTP or your hosting file manager, which is safer if you are unfamiliar with editing theme files directly).+ 2. Open your child theme's `functions.php` file (or your parent theme's `functions.php` if you are not using a child theme, with the above caution in mind).+ 3. Add the following code to the end of the file:+ ```php+ function add_rybbit_script_to_head() {+ ?>+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID" // Replace YOUR_SITE_ID with your actual Site ID+ async+ defer+ ></script>+ <?php+ }+ add_action('wp_head', 'add_rybbit_script_to_head');+ ```+ 4. Save the file. Ensure you replace `"YOUR_SITE_ID"` with your actual Rybbit Site ID.+ </Tabs.Tab>+ <Tabs.Tab>+ **Modify `header.php` (For self-hosted WordPress with child theme, less common)**++ You can also manually add the script to your theme's HTML header. This method is generally less preferred than using `functions.php` but is an option. It is **strongly recommended to make these changes in a child theme**. If you modify the parent theme files directly, your changes may be lost when the theme is updated.++ 1. Go to **Appearance > Theme File Editor**. (Alternatively, edit the file via FTP/SFTP or your hosting file manager, which is safer if you are unfamiliar with editing theme files directly).+ 2. Open your child theme's `header.php` file (or your parent theme's `header.php` if you are not using a child theme, with the above caution in mind).+ 3. Paste your Rybbit tracking snippet right before the closing `</head>` tag:+ ```html+ <script+ src="https://app.rybbit.io/api/script.js"+ data-site-id="YOUR_SITE_ID" <!-- Replace YOUR_SITE_ID with your actual Site ID -->+ async+ defer+ ></script>+ ```+ 4. Save the file. Ensure you replace `YOUR_SITE_ID` with your actual Rybbit Site ID.+ </Tabs.Tab>+</Tabs>++Remember to replace `"YOUR_SITE_ID"` in the snippets with your actual Site ID from your Rybbit dashboard.diff --git a/docs/src/content/integrations/framer.mdx b/docs/src/content/integrations/framer.mdxdeleted file mode 100644index 9a5ea8af2..000000000--- a/docs/src/content/integrations/framer.mdx+++ /dev/null@@ -1,28 +0,0 @@-import { Steps } from "nextra/components"--# Framer--Rybbit enables you to gather analytics on user behavior, capture custom events, record sessions, and more within your Framer site.--## How to Add Rybbit to Framer--<Steps>-### 1. Retrieve Your Tracking Script--Navigate to your Rybbit dashboard to obtain your code snippet.--```html-<script- src="https://app.rybbit.io/api/script.js"- data-site-id="YOUR_SITE_ID"- async-></script>-```--### 2. Add the Snippet to Your Framer Project--- Open your Framer project.-- Go to **Site Settings > General** and scroll down to **Custom Code**.-- Paste your snippet into the `<head>` tag section (start or end).-- Publish your changes.-</Steps>diff --git a/docs/src/content/integrations/shopify.mdx b/docs/src/content/integrations/shopify.mdxdeleted file mode 100644index c7198d026..000000000--- a/docs/src/content/integrations/shopify.mdx+++ /dev/null@@ -1,28 +0,0 @@-import { Steps } from "nextra/components"--# Shopify--Rybbit can be integrated with your Shopify store to capture events, track conversions, and analyze user behavior.--## How to Add Rybbit to Shopify--<Steps>-### 1. Retrieve Your Tracking Script--Navigate to your Rybbit dashboard to obtain your code snippet.--```html-<script- src="https://app.rybbit.io/api/script.js"- data-site-id="YOUR_SITE_ID"- async-></script>-```--### 2. Add the Snippet to Your Shopify Store--- In Shopify, go to **Online Store > Themes** and click **Edit code** from the settings dropdown beside the **Customize** button.-- Open `theme.liquid` in the **Layout** folder.-- Just before the closing `</head>` tag, insert your snippet.-- Save the file to apply the changes to your live store.-</Steps>diff --git a/docs/src/content/integrations/webflow.mdx b/docs/src/content/integrations/webflow.mdxdeleted file mode 100644index 0f2bb33e6..000000000--- a/docs/src/content/integrations/webflow.mdx+++ /dev/null@@ -1,27 +0,0 @@-import { Steps } from "nextra/components"--# Webflow--Rybbit enables you to collect analytics, capture custom events, and more on your Webflow site.--## How to Add Rybbit to Webflow--<Steps>-### 1. Retrieve Your Tracking Script--Navigate to your Rybbit dashboard to obtain your code snippet.--```html-<script- src="https://app.rybbit.io/api/script.js"- data-site-id="YOUR_SITE_ID"- async-></script>-```--### 2. Add the Snippet to Your Webflow Project--- In your Webflow project, go to **Site settings > Custom code**.-- Paste your snippet into the **Head code** section.-- Save and publish your changes.-</Steps>diff --git a/docs/src/content/integrations/wordpress.mdx b/docs/src/content/integrations/wordpress.mdxdeleted file mode 100644index e471baea8..000000000--- a/docs/src/content/integrations/wordpress.mdx+++ /dev/null@@ -1,47 +0,0 @@-# WordPress--You can integrate Rybbit into your WordPress site to track user behavior and gather analytics. There are several ways to do this depending on whether you're using a hosted WordPress.com site or a self-hosted WordPress.org installation.--## Option 1: Use the Rybbit WordPress Plugin--You can find our community-maintained WordPress plugin as well as installation instructions [here](https://github.com/didyouexpectthat/rybbit-analytics-tracking-code).--## Option 2: Use Insert Headers and Footers Plugin--If you don't want to modify your theme files directly, you can use a plugin to inject the Rybbit snippet. This is the only option for WordPress.com users.--1. Install the [Insert Headers and Footers](https://wordpress.com/plugins/insert-headers-and-footers) plugin.-2. Go to the plugin settings and paste your snippet into the `<header>` section.-3. Save your changes.--## Option 3: Add to `functions.php`--If you're using a self-hosted WordPress theme, you can add the script via `functions.php`.--1. In your WordPress dashboard, go to **Tools > Theme File Editor**.-2. Open the `functions.php` file.-3. Add the following code:--```php-function add_rybbit() {- ?>- <script- src="https://app.rybbit.io/api/script.js"- data-site-id="YOUR_SITE_ID"- async- ></script>- <?php-}-add_action("wp_head", "add_rybbit");-```--4. Save the file.--## Option 4: Modify `header.php`--You can also manually add the script to your theme's HTML header if using an older version of WordPress.--1. Go to **Appearance > Theme Editor**.-2. Open the `header.php` file.-3. Paste your snippet right before the closing `</head>` tag.-4. Save the file.diff --git a/memory-bank/activeContext.md b/memory-bank/activeContext.mdindex e5734475b..71ba8a7ee 100644--- a/memory-bank/activeContext.md+++ b/memory-bank/activeContext.md@@ -4,17 +4,17 @@ This file tracks the project's current status, including recent changes, current## Current Focus-- Memory Bank initialization and project context establishment-- Understanding the current state of the Rybbit Analytics platform-- Preparing for future development tasks and architectural decisions+- Creating new integration guides for Squarespace, Wix, Hugo, Jekyll, Drupal, and Laravel.+- Answering user question regarding Laravel compatibility with client-side script.## Recent Changes2025-05-31 13:49:39 - Memory Bank system initialized for Rybbit Analytics project+2025-06-06 23:18:00 - User requested creation of new integration guides for top priority platforms.## Open Questions/Issues-- What specific development tasks or improvements are currently prioritized?-- Are there any known technical debt items or performance issues to address?-- What new features or enhancements are planned for the platform?-- Are there any deployment or infrastructure concerns that need attention?+- What specific development tasks or improvements are currently prioritized? (Previously existing)+- Are there any known technical debt items or performance issues to address? (Previously existing)+- What new features or enhancements are planned for the platform? (Previously existing)+- Are there any deployment or infrastructure concerns that need attention? (Previously existing)diff --git a/memory-bank/progress.md b/memory-bank/progress.mdindex 04294e20e..d7fd06059 100644--- a/memory-bank/progress.md+++ b/memory-bank/progress.md@@ -77,3 +77,21 @@ This file tracks the project's progress using a task list format.- Uses PSL to accurately determine registrable domains (handles all TLDs correctly)- Added robust fallback logic for edge cases- Eliminates hardcoded TLD list that was incomplete and unreliable++2025-06-06 23:20:00 - Completed creation of new integration guides++- Completed: Create Squarespace integration guide ([`docs/src/content/integrations/squarespace.mdx`](docs/src/content/integrations/squarespace.mdx:1))+- Completed: Create Wix integration guide ([`docs/src/content/integrations/wix.mdx`](docs/src/content/integrations/wix.mdx:1))+- Completed: Create Hugo integration guide ([`docs/src/content/integrations/hugo.mdx`](docs/src/content/integrations/hugo.mdx:1))+- Completed: Create Jekyll integration guide ([`docs/src/content/integrations/jekyll.mdx`](docs/src/content/integrations/jekyll.mdx:1))+- Completed: Create Drupal integration guide ([`docs/src/content/integrations/drupal.mdx`](docs/src/content/integrations/drupal.mdx:1))+- Completed: Create Laravel integration guide ([`docs/src/content/integrations/laravel.mdx`](docs/src/content/integrations/laravel.mdx:1))+- Created: [`docs/src/content/integrations/_meta.json`](docs/src/content/integrations/_meta.json:1) to include new guides in sidebar.++2025-06-07 00:16:00 - Completed review and standardization of integration guides++- Standardized script tags (URL, `async defer`) across all relevant guides in `docs/src/content/guides/`.+- Updated Next.js guide ([`docs/src/content/guides/react/next-js.mdx`](docs/src/content/guides/react/next-js.mdx:1)) with SPA page view tracking callout and custom event tracking section.+- Significantly expanded Shopify guide ([`docs/src/content/guides/shopify.mdx`](docs/src/content/guides/shopify.mdx:1)) with e-commerce event tracking.+- Expanded Framer guide ([`docs/src/content/guides/framer.mdx`](docs/src/content/guides/framer.mdx:1)) and Webflow guide ([`docs/src/content/guides/webflow.mdx`](docs/src/content/guides/webflow.mdx:1)) with notes on SPA behavior and custom event tracking.+- Corrected minor inconsistencies in Hugo and Jekyll guides.