Skip to content

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

Add ThriveCart integration to NoData component and documentation

Bill Yang0a579fac64eb
diff --git a/client/public/platforms/thrivecart.svg b/client/public/platforms/thrivecart.svg
new file mode 100644
index 000000000..35b0c9da3
--- /dev/null
+++ b/client/public/platforms/thrivecart.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 90 90" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path fill="#00C8C9" d="M0 0h90v90H0z"/><path d="M28.75 63a4.25 4.25 0 1 1 0 8.5 4.25 4.25 0 0 1 0-8.5Zm34.5 0a4.25 4.25 0 1 1 0 8.5 4.25 4.25 0 0 1 0-8.5Zm8.848-46a2 2 0 0 1 1.967 2.362l-6.263 34A2 2 0 0 1 65.835 55h-3.433a2 2 0 0 1-1.967-2.362l6.263-34A2 2 0 0 1 68.665 17h3.433Zm-14.52 12a2 2 0 0 1 1.965 2.378l-4.231 22A2 2 0 0 1 53.348 55h-3.427a2 2 0 0 1-1.964-2.378l4.231-22A2 2 0 0 1 54.152 29h3.427ZM43.14 40a2 2 0 0 1 1.973 2.329l-1.833 11A2 2 0 0 1 41.306 55H37.27a1.5 1.5 0 0 1-1.48-1.747l1.93-11.582A2 2 0 0 1 39.694 40h3.445ZM23.833 25a2 2 0 0 1 1.968 1.64l4.874 26.59A1.5 1.5 0 0 1 29.2 55h-3.006a2 2 0 0 1-1.973-1.671l-3.667-22.003H13.21a2 2 0 0 1-1.976-1.688l-.459-2.904A1.5 1.5 0 0 1 12.256 25h11.577Z" fill="#FFF"/></g></svg>
\ No newline at end of file
diff --git a/client/src/app/[site]/components/Header/NoData.tsx b/client/src/app/[site]/components/Header/NoData.tsx
index b88fee758..de0be9dc5 100644
--- a/client/src/app/[site]/components/Header/NoData.tsx
+++ b/client/src/app/[site]/components/Header/NoData.tsx
@@ -138,6 +138,12 @@ export function NoData() {
description=""
href="https://rybbit.com/docs/guides/svelte/sveltekit"
/>
+ <Card
+ icon={<img src="/platforms/thrivecart.svg" alt="ThriveCart" className="w-5 h-5 grayscale" />}
+ title="ThriveCart"
+ description=""
+ href="https://rybbit.com/docs/guides/thrivecart"
+ />
<Card
icon={<SiAstro className="w-5 h-5" />}
title="Astro"
diff --git a/docs/content/docs/guides/meta.json b/docs/content/docs/guides/meta.json
index dbc7161e3..7a3af5550 100644
--- a/docs/content/docs/guides/meta.json
+++ b/docs/content/docs/guides/meta.json
@@ -16,6 +16,7 @@
"shopify",
"squarespace",
"svelte",
+ "thrivecart",
"vue",
"webflow",
"wix",
diff --git a/docs/content/docs/guides/thrivecart.mdx b/docs/content/docs/guides/thrivecart.mdx
new file mode 100644
index 000000000..6de27ee70
--- /dev/null
+++ b/docs/content/docs/guides/thrivecart.mdx
@@ -0,0 +1,157 @@
+---
+title: "ThriveCart"
+description: "Integrate Rybbit Analytics with your ThriveCart checkout pages"
+---
+
+import { Step, Steps } from "fumadocs-ui/components/steps";
+import { Callout } from "fumadocs-ui/components/callout";
+
+# ThriveCart
+
+Rybbit can be integrated with ThriveCart to track cart views, purchases, and other conversion events on your checkout pages.
+
+<Callout type="warn">
+ ThriveCart strips out the standard `data-site-id` attribute from scripts. You must use the alternative installation method below for Rybbit to work correctly.
+</Callout>
+
+## Adding the Tracking Script
+
+The standard Rybbit script won't work in ThriveCart because ThriveCart removes the `data-site-id` attribute. Instead, use this JavaScript snippet that dynamically creates the script element:
+
+<Steps>
+<Step>
+### Access ThriveCart Settings
+
+In your ThriveCart dashboard, navigate to the checkout page you want to track. Go to **Settings > Tracking** or the custom scripts section.
+</Step>
+
+<Step>
+### Add the Tracking Script
+
+Paste the following script into the header scripts section:
+
+```html
+<script>
+(function() {
+ var s = document.createElement('script');
+ s.src = 'https://app.rybbit.io/api/script.js';
+ s.async = true;
+ s.setAttribute('data-site-id', 'YOUR_SITE_ID');
+ document.head.appendChild(s);
+})();
+</script>
+```
+
+Replace `YOUR_SITE_ID` with your actual Rybbit Site ID from your dashboard.
+</Step>
+
+<Step>
+### Save and Test
+
+Save your changes and visit your checkout page. Check your Rybbit dashboard to confirm pageviews are being tracked.
+</Step>
+</Steps>
+
+## Tracking Purchase Events
+
+ThriveCart also interferes with how events are fired, so purchase events need special handling to ensure they fire reliably and only once per transaction.
+
+Add this script to your ThriveCart **success page** (the page shown after a completed purchase):
+
+```html
+<script>
+(function () {
+ // --- CONFIGURE YOUR EVENT ---
+ var EVENT_NAME = "purchase";
+ var PAYLOAD = {
+ content_name: "Your Product Name",
+ value: 97.00,
+ currency: "USD"
+ };
+ var SITE_ID = "YOUR_SITE_ID";
+ // -----------------------------
+
+ // Prevent duplicate events on refresh/back navigation
+ var SENT_KEY = "rybbit_" + EVENT_NAME + "_sent_v1";
+ try {
+ if (sessionStorage.getItem(SENT_KEY) === "1") return;
+ sessionStorage.setItem(SENT_KEY, "1");
+ } catch (e) {}
+
+ function isReady() {
+ return window.rybbit && typeof window.rybbit.event === "function";
+ }
+
+ function send() {
+ window.rybbit.event(EVENT_NAME, PAYLOAD);
+ }
+
+ function waitThenSend(timeoutMs) {
+ var start = Date.now();
+ (function check() {
+ if (isReady()) return send();
+ if (Date.now() - start < timeoutMs) return setTimeout(check, 150);
+ // Fail silently if timeout reached
+ })();
+ }
+
+ function ensureScriptLoaded() {
+ // Avoid duplicate script loads
+ if (document.querySelector('script[src="https://app.rybbit.io/api/script.js"]')) return;
+
+ var s = document.createElement("script");
+ s.src = "https://app.rybbit.io/api/script.js";
+ s.async = true;
+ s.setAttribute("data-site-id", SITE_ID);
+ s.onload = function () { waitThenSend(3000); };
+ document.head.appendChild(s);
+ }
+
+ // If Rybbit is already loaded, send immediately
+ if (isReady()) return send();
+
+ // Otherwise, load the script and wait for it
+ ensureScriptLoaded();
+ waitThenSend(8000);
+})();
+</script>
+```
+
+### Configuration
+
+Update the configuration variables at the top of the script:
+
+- `EVENT_NAME`: The name of the event (e.g., `"purchase"`, `"checkout_complete"`)
+- `PAYLOAD`: An object containing event data:
+ - `content_name`: The product name
+ - `value`: The purchase amount
+ - `currency`: The currency code (e.g., `"USD"`, `"GBP"`, `"EUR"`)
+- `SITE_ID`: Your Rybbit Site ID
+
+## Tracking Multiple Products
+
+If you have different products, create separate success pages or use ThriveCart's dynamic variables (if available) to populate the payload. Each product page should have its own configured script with the appropriate product name and price.
+
+## Using with Subdomains
+
+If your ThriveCart is hosted on a subdomain (e.g., `sales.yourdomain.com`) while your main site is on `yourdomain.com`, Rybbit will track both as part of the same site as long as you use the same Site ID. This allows you to create funnels that track the user journey from your main site through to the ThriveCart checkout and purchase.
+
+## Troubleshooting
+
+### Events not appearing in Rybbit
+
+1. **Check the script is loading**: Open your browser's Developer Tools (F12), go to the Network tab, and look for `script.js` being loaded from `app.rybbit.io`.
+2. **Check for JavaScript errors**: In the Console tab, look for any red error messages.
+3. **Verify your Site ID**: Make sure you've replaced `YOUR_SITE_ID` with your actual Site ID from the Rybbit dashboard.
+
+### Duplicate events
+
+The script includes session storage protection to prevent duplicate events on page refresh. If you're still seeing duplicates:
+- Clear your browser's session storage and test again
+- Make sure you only have one instance of the event script on the page
+
+### Script not loading
+
+If the script isn't loading at all, ThriveCart may be blocking it. Try:
+- Adding the script to a different location (footer instead of header)
+- Contacting ThriveCart support to ensure custom scripts are enabled for your account
diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx
index a63b4a072..e4e4717d2 100644
--- a/docs/content/docs/index.mdx
+++ b/docs/content/docs/index.mdx
@@ -29,7 +29,7 @@ import {
SiWebflow,
SiWix,
SiWoocommerce,
- SiWordpress
+ SiWordpress,
} from '@icons-pack/react-simple-icons';
**Rybbit** is a powerful open source web and products analytics platform. Check out our [live demo](https://demo.rybbit.com/1) using a real production site that sends over **15,000,000** events a month.
@@ -164,10 +164,16 @@ And then learn how to add the [tracking script](/docs/script) to your website to
href="/docs/guides/squarespace"
className="flex items-center gap-2"
/>
- <Card
+ <Card
icon={<SiSvelte />}
- title="Svelte"
- href="/docs/guides/svelte/vite"
+ title="Svelte"
+ href="/docs/guides/svelte/vite"
+ className="flex items-center gap-2"
+ />
+ <Card
+ icon={<Image src="/platforms/thrivecart.svg" alt="ThriveCart" width={16} height={16} className="grayscale" />}
+ title="ThriveCart"
+ href="/docs/guides/thrivecart"
className="flex items-center gap-2"
/>
<Card
diff --git a/docs/public/platforms/thrivecart.svg b/docs/public/platforms/thrivecart.svg
new file mode 100644
index 000000000..35b0c9da3
--- /dev/null
+++ b/docs/public/platforms/thrivecart.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 90 90" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path fill="#00C8C9" d="M0 0h90v90H0z"/><path d="M28.75 63a4.25 4.25 0 1 1 0 8.5 4.25 4.25 0 0 1 0-8.5Zm34.5 0a4.25 4.25 0 1 1 0 8.5 4.25 4.25 0 0 1 0-8.5Zm8.848-46a2 2 0 0 1 1.967 2.362l-6.263 34A2 2 0 0 1 65.835 55h-3.433a2 2 0 0 1-1.967-2.362l6.263-34A2 2 0 0 1 68.665 17h3.433Zm-14.52 12a2 2 0 0 1 1.965 2.378l-4.231 22A2 2 0 0 1 53.348 55h-3.427a2 2 0 0 1-1.964-2.378l4.231-22A2 2 0 0 1 54.152 29h3.427ZM43.14 40a2 2 0 0 1 1.973 2.329l-1.833 11A2 2 0 0 1 41.306 55H37.27a1.5 1.5 0 0 1-1.48-1.747l1.93-11.582A2 2 0 0 1 39.694 40h3.445ZM23.833 25a2 2 0 0 1 1.968 1.64l4.874 26.59A1.5 1.5 0 0 1 29.2 55h-3.006a2 2 0 0 1-1.973-1.671l-3.667-22.003H13.21a2 2 0 0 1-1.976-1.688l-.459-2.904A1.5 1.5 0 0 1 12.256 25h11.577Z" fill="#FFF"/></g></svg>
\ No newline at end of file