Skip to content

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

Update Rybbit event tracking method across documentation guides

Bill Yangb5a8a243c4c2
diff --git a/docs-v2/content/docs/guides/angular.mdx b/docs-v2/content/docs/guides/angular.mdx
index f9b0fc68d..b8f5b5709 100644
--- a/docs-v2/content/docs/guides/angular.mdx
+++ b/docs-v2/content/docs/guides/angular.mdx
@@ -123,8 +123,8 @@ declare global {
}})
export class MyFeatureComponent {{
onFeatureClick(): void {{
- if (window.rybbit && typeof window.rybbit.trackEvent === 'function') {{
- window.rybbit.trackEvent('feature_used', {{ featureName: 'Amazing Feature' }});
+ if (window.rybbit && typeof window.rybbit.event === 'function') {{
+ window.rybbit.event('feature_used', {{ featureName: 'Amazing Feature' }});
}} else {{
console.warn('Rybbit tracking not available.');
}}
diff --git a/docs-v2/content/docs/guides/astro.mdx b/docs-v2/content/docs/guides/astro.mdx
index cfc6e5d06..67635d3e4 100644
--- a/docs-v2/content/docs/guides/astro.mdx
+++ b/docs-v2/content/docs/guides/astro.mdx
@@ -115,7 +115,7 @@ You can track custom events from client-side JavaScript within your Astro site.
<script>
document.getElementById('my-astro-button')?.addEventListener('click', () => {
if (window.rybbit) {
- window.rybbit.trackEvent('astro_button_click', { source: 'MyButton.astro' });
+ window.rybbit.event('astro_button_click', { source: 'MyButton.astro' });
}
});
</script>
@@ -132,7 +132,7 @@ import React from 'react';
export default function MyReactIsland() {
const handleClick = () => {
if (window.rybbit) {
- window.rybbit.trackEvent('react_island_click', { island: 'MyReactIsland' });
+ window.rybbit.event('react_island_click', { island: 'MyReactIsland' });
}
};
return <button onClick={handleClick}>Click Me (React Island)</button>;
diff --git a/docs-v2/content/docs/guides/bubble.mdx b/docs-v2/content/docs/guides/bubble.mdx
index 5dc28b665..980abe272 100644
--- a/docs-v2/content/docs/guides/bubble.mdx
+++ b/docs-v2/content/docs/guides/bubble.mdx
@@ -93,7 +93,7 @@ You can track custom events in Bubble by using a workflow action that runs JavaS
```javascript
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('bubble_event_name', {
+ window.rybbit.event('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)
@@ -111,7 +111,7 @@ Replace `'bubble_event_name'` with a descriptive name for your event. You can us
// let itemCategory = "Dynamic Category from Bubble";
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('item_interaction', {
+ window.rybbit.event('item_interaction', {
name: itemName, // Replace with actual dynamic data
category: itemCategory // Replace with actual dynamic data
});
diff --git a/docs-v2/content/docs/guides/docusaurus.mdx b/docs-v2/content/docs/guides/docusaurus.mdx
index 2b273b83e..f44f0e5cf 100644
--- a/docs-v2/content/docs/guides/docusaurus.mdx
+++ b/docs-v2/content/docs/guides/docusaurus.mdx
@@ -101,7 +101,7 @@ 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 || {});
+ window.rybbit.event(eventName || 'docusaurus_custom_click', eventData || {});
}
};
@@ -139,7 +139,7 @@ export function onRouteUpdate({location, previousLocation}) {
document.querySelectorAll('a[target="_blank"]').forEach(link => {
link.addEventListener('click', () => {
if (window.rybbit) {
- window.rybbit.trackEvent('external_link_click', { href: link.href });
+ window.rybbit.event('external_link_click', { href: link.href });
}
});
});
diff --git a/docs-v2/content/docs/guides/framer.mdx b/docs-v2/content/docs/guides/framer.mdx
index 3b05c9698..4e22fb9ad 100644
--- a/docs-v2/content/docs/guides/framer.mdx
+++ b/docs-v2/content/docs/guides/framer.mdx
@@ -59,7 +59,7 @@ export function withRybbitTracking(Component: ComponentType): ComponentType {
return (props) => {
const handleClick = () => {
if (typeof window !== "undefined" && window.rybbit) {
- window.rybbit.trackEvent('framer_button_click', {
+ window.rybbit.event('framer_button_click', {
buttonName: props.text || 'Unnamed Button',
page: props.currentPage?.name || 'Unknown Page'
});
@@ -87,7 +87,7 @@ import React from "react"
export function MyInteractiveComponent(props) {
const handleInteraction = () => {
if (typeof window !== "undefined" && window.rybbit) {
- window.rybbit.trackEvent('framer_component_interaction', {
+ window.rybbit.event('framer_component_interaction', {
componentName: 'MyInteractiveComponent',
detail: 'User interacted'
});
diff --git a/docs-v2/content/docs/guides/react/gatsby.mdx b/docs-v2/content/docs/guides/react/gatsby.mdx
index 15314c261..58030ea06 100644
--- a/docs-v2/content/docs/guides/react/gatsby.mdx
+++ b/docs-v2/content/docs/guides/react/gatsby.mdx
@@ -101,7 +101,7 @@ 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 || {});
+ window.rybbit.event(eventName || 'gatsby_button_click', eventData || {});
}
};
diff --git a/docs-v2/content/docs/guides/react/next-js.mdx b/docs-v2/content/docs/guides/react/next-js.mdx
index 2f559137d..1c040e47b 100644
--- a/docs-v2/content/docs/guides/react/next-js.mdx
+++ b/docs-v2/content/docs/guides/react/next-js.mdx
@@ -147,8 +147,8 @@ Once the Rybbit script is loaded via the Next.js `Script` component, you can tra
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 });
+ if (typeof window !== 'undefined' && window.rybbit && typeof window.rybbit.event === 'function') {
+ window.rybbit.event('button_click', { buttonTitle: title });
} else {
console.warn('Rybbit tracking not available.');
}
diff --git a/docs-v2/content/docs/guides/react/remix.mdx b/docs-v2/content/docs/guides/react/remix.mdx
index 4dde52a23..86dcf49c9 100644
--- a/docs-v2/content/docs/guides/react/remix.mdx
+++ b/docs-v2/content/docs/guides/react/remix.mdx
@@ -90,7 +90,7 @@ Once the Rybbit script is installed and loaded, you can track custom events from
export default function MyFeatureRoute() {
const handleButtonClick = () => {
if (typeof window !== "undefined" && window.rybbit) {
- window.rybbit.trackEvent('remix_feature_click', { feature: 'Special Offer' });
+ window.rybbit.event('remix_feature_click', { feature: 'Special Offer' });
}
};
diff --git a/docs-v2/content/docs/guides/react/vite-cra.mdx b/docs-v2/content/docs/guides/react/vite-cra.mdx
index ff16f4b5a..ee5e7ea6f 100644
--- a/docs-v2/content/docs/guides/react/vite-cra.mdx
+++ b/docs-v2/content/docs/guides/react/vite-cra.mdx
@@ -83,7 +83,7 @@ Once the script is installed, you can track custom events from any of your React
function MyComponent() {
const handleButtonClick = () => {
if (window.rybbit) {
- window.rybbit.trackEvent('button_click', { category: 'CTA', label: 'Learn More' });
+ window.rybbit.event('button_click', { category: 'CTA', label: 'Learn More' });
}
};
diff --git a/docs-v2/content/docs/guides/shopify.mdx b/docs-v2/content/docs/guides/shopify.mdx
index c4f7ba2bd..1880c5402 100644
--- a/docs-v2/content/docs/guides/shopify.mdx
+++ b/docs-v2/content/docs/guides/shopify.mdx
@@ -63,7 +63,7 @@ Add the following script towards the end of the file, or within a relevant produ
const rybbitProduct = {{ product | json }};
const rybbitCurrentVariant = {{ product.selected_or_first_available_variant | json }};
- window.rybbit.trackEvent('view_item', {
+ window.rybbit.event('view_item', {
item_id: rybbitCurrentVariant.sku || rybbitCurrentVariant.id,
item_name: rybbitProduct.title,
item_variant: rybbitCurrentVariant.title === 'Default Title' ? null : rybbitCurrentVariant.title,
@@ -99,7 +99,7 @@ document.addEventListener('DOMContentLoaded', function() {
quantity = parseInt(quantityInput.value, 10);
}
- window.rybbit.trackEvent('add_to_cart', {
+ window.rybbit.event('add_to_cart', {
item_id: rybbitCurrentVariant.sku || rybbitCurrentVariant.id,
item_name: rybbitProduct.title,
item_variant: rybbitCurrentVariant.title === 'Default Title' ? null : rybbitCurrentVariant.title,
@@ -158,7 +158,7 @@ document.addEventListener('DOMContentLoaded', function() {
});
});
- window.rybbit.trackEvent('begin_checkout', {
+ window.rybbit.event('begin_checkout', {
currency: rybbitCart.currency,
value: parseFloat(rybbitCart.total_price) / 100,
items: items
@@ -192,7 +192,7 @@ Scroll down to the **Order status page** section. In the **Additional scripts**
});
});
- window.rybbit.trackEvent('purchase', {
+ window.rybbit.event('purchase', {
transaction_id: rybbitCheckout.order_number,
value: parseFloat(rybbitCheckout.total_price),
tax: parseFloat(rybbitCheckout.tax_price),
diff --git a/docs-v2/content/docs/guides/svelte/sveltekit.mdx b/docs-v2/content/docs/guides/svelte/sveltekit.mdx
index 54f7541ef..2eac37c72 100644
--- a/docs-v2/content/docs/guides/svelte/sveltekit.mdx
+++ b/docs-v2/content/docs/guides/svelte/sveltekit.mdx
@@ -89,7 +89,7 @@ From any Svelte component within your SvelteKit app, you can track custom events
<script>
function handleAction() {
if (typeof window !== 'undefined' && window.rybbit) {
- window.rybbit.trackEvent('user_action_sveltekit', { component: 'MySvelteKitComponent' });
+ window.rybbit.event('user_action_sveltekit', { component: 'MySvelteKitComponent' });
}
}
</script>
diff --git a/docs-v2/content/docs/guides/svelte/vite.mdx b/docs-v2/content/docs/guides/svelte/vite.mdx
index ad32b4989..9fba28087 100644
--- a/docs-v2/content/docs/guides/svelte/vite.mdx
+++ b/docs-v2/content/docs/guides/svelte/vite.mdx
@@ -79,7 +79,7 @@ From any Svelte component, you can track custom events:
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' });
+ window.rybbit.event('user_action_svelte_vite', { component: 'MySvelteViteComponent' });
}
}
</script>
diff --git a/docs-v2/content/docs/guides/vue/nuxt.mdx b/docs-v2/content/docs/guides/vue/nuxt.mdx
index 7c1856c47..30f769543 100644
--- a/docs-v2/content/docs/guides/vue/nuxt.mdx
+++ b/docs-v2/content/docs/guides/vue/nuxt.mdx
@@ -85,7 +85,7 @@ From any Vue component within your Nuxt.js application, you can track custom eve
<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' });
+ window.rybbit.event('nuxt_interaction', { detail: 'User clicked important button' });
}
}
</script>
diff --git a/docs-v2/content/docs/guides/vue/vite.mdx b/docs-v2/content/docs/guides/vue/vite.mdx
index 8267c8d00..1190ec81a 100644
--- a/docs-v2/content/docs/guides/vue/vite.mdx
+++ b/docs-v2/content/docs/guides/vue/vite.mdx
@@ -102,8 +102,8 @@ From any Vue component or method, you can track custom events:
<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' });
+ if (window.rybbit && typeof window.rybbit.event === 'function') {
+ window.rybbit.event('custom_vue_action', { detail: 'User performed a client-side Vue action' });
}
}
</script>
diff --git a/docs-v2/content/docs/guides/webflow.mdx b/docs-v2/content/docs/guides/webflow.mdx
index 13d53aafe..45d7fb054 100644
--- a/docs-v2/content/docs/guides/webflow.mdx
+++ b/docs-v2/content/docs/guides/webflow.mdx
@@ -65,7 +65,7 @@ You can track custom events in Webflow by adding custom JavaScript code, either
if (specialButton) {
specialButton.addEventListener('click', function() {
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('webflow_button_click', {
+ window.rybbit.event('webflow_button_click', {
button_id: 'my-special-button',
button_text: specialButton.textContent || specialButton.innerText,
page_path: window.location.pathname
@@ -97,7 +97,7 @@ You can track custom events in Webflow by adding custom JavaScript code, either
// 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', {
+ window.rybbit.event('webflow_form_submit', {
form_id: 'contact-form',
// You can try to get form field values here if needed, but be mindful of PII.
});
diff --git a/docs/src/content/guides/angular.mdx b/docs/src/content/guides/angular.mdx
index 6c6caf9d1..c9a3921c2 100644
--- a/docs/src/content/guides/angular.mdx
+++ b/docs/src/content/guides/angular.mdx
@@ -111,8 +111,8 @@ declare global {
}})
export class MyFeatureComponent {{
onFeatureClick(): void {{
- if (window.rybbit && typeof window.rybbit.trackEvent === 'function') {{
- window.rybbit.trackEvent('feature_used', {{ featureName: 'Amazing Feature' }});
+ if (window.rybbit && typeof window.rybbit.event === 'function') {{
+ window.rybbit.event('feature_used', {{ featureName: 'Amazing Feature' }});
}} else {{
console.warn('Rybbit tracking not available.');
}}
diff --git a/docs/src/content/guides/astro.mdx b/docs/src/content/guides/astro.mdx
index 9ead46c78..91c735477 100644
--- a/docs/src/content/guides/astro.mdx
+++ b/docs/src/content/guides/astro.mdx
@@ -105,7 +105,7 @@ You can track custom events from client-side JavaScript within your Astro site.
<script>
document.getElementById('my-astro-button')?.addEventListener('click', () => {
if (window.rybbit) {
- window.rybbit.trackEvent('astro_button_click', { source: 'MyButton.astro' });
+ window.rybbit.event('astro_button_click', { source: 'MyButton.astro' });
}
});
</script>
@@ -122,7 +122,7 @@ import React from 'react';
export default function MyReactIsland() {
const handleClick = () => {
if (window.rybbit) {
- window.rybbit.trackEvent('react_island_click', { island: 'MyReactIsland' });
+ window.rybbit.event('react_island_click', { island: 'MyReactIsland' });
}
};
return <button onClick={handleClick}>Click Me (React Island)</button>;
diff --git a/docs/src/content/guides/bubble.mdx b/docs/src/content/guides/bubble.mdx
index 8e88583fa..dc40fea16 100644
--- a/docs/src/content/guides/bubble.mdx
+++ b/docs/src/content/guides/bubble.mdx
@@ -74,7 +74,7 @@ You can track custom events in Bubble by using a workflow action that runs JavaS
```javascript
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('bubble_event_name', {
+ window.rybbit.event('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)
@@ -92,7 +92,7 @@ Replace `'bubble_event_name'` with a descriptive name for your event. You can us
// let itemCategory = "Dynamic Category from Bubble";
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('item_interaction', {
+ window.rybbit.event('item_interaction', {
name: itemName, // Replace with actual dynamic data
category: itemCategory // Replace with actual dynamic data
});
diff --git a/docs/src/content/guides/docusaurus.mdx b/docs/src/content/guides/docusaurus.mdx
index 4ee0af3f5..ed7ff17f2 100644
--- a/docs/src/content/guides/docusaurus.mdx
+++ b/docs/src/content/guides/docusaurus.mdx
@@ -91,7 +91,7 @@ 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 || {});
+ window.rybbit.event(eventName || 'docusaurus_custom_click', eventData || {});
}
};
@@ -129,7 +129,7 @@ export function onRouteUpdate({location, previousLocation}) {
document.querySelectorAll('a[target="_blank"]').forEach(link => {
link.addEventListener('click', () => {
if (window.rybbit) {
- window.rybbit.trackEvent('external_link_click', { href: link.href });
+ window.rybbit.event('external_link_click', { href: link.href });
}
});
});
diff --git a/docs/src/content/guides/framer.mdx b/docs/src/content/guides/framer.mdx
index 470288f11..73de1ff91 100644
--- a/docs/src/content/guides/framer.mdx
+++ b/docs/src/content/guides/framer.mdx
@@ -52,7 +52,7 @@ export function withRybbitTracking(Component: ComponentType): ComponentType {
return (props) => {
const handleClick = () => {
if (typeof window !== "undefined" && window.rybbit) {
- window.rybbit.trackEvent('framer_button_click', {
+ window.rybbit.event('framer_button_click', {
buttonName: props.text || 'Unnamed Button',
page: props.currentPage?.name || 'Unknown Page'
});
@@ -80,7 +80,7 @@ import React from "react"
export function MyInteractiveComponent(props) {
const handleInteraction = () => {
if (typeof window !== "undefined" && window.rybbit) {
- window.rybbit.trackEvent('framer_component_interaction', {
+ window.rybbit.event('framer_component_interaction', {
componentName: 'MyInteractiveComponent',
detail: 'User interacted'
});
diff --git a/docs/src/content/guides/react/gatsby.mdx b/docs/src/content/guides/react/gatsby.mdx
index 93e445c75..fceb0e015 100644
--- a/docs/src/content/guides/react/gatsby.mdx
+++ b/docs/src/content/guides/react/gatsby.mdx
@@ -97,7 +97,7 @@ 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 || {});
+ window.rybbit.event(eventName || 'gatsby_button_click', eventData || {});
}
};
diff --git a/docs/src/content/guides/react/next-js.mdx b/docs/src/content/guides/react/next-js.mdx
index 321b22525..363735521 100644
--- a/docs/src/content/guides/react/next-js.mdx
+++ b/docs/src/content/guides/react/next-js.mdx
@@ -143,8 +143,8 @@ Once the Rybbit script is loaded via the Next.js `Script` component, you can tra
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 });
+ if (typeof window !== 'undefined' && window.rybbit && typeof window.rybbit.event === 'function') {
+ window.rybbit.event('button_click', { buttonTitle: title });
} else {
console.warn('Rybbit tracking not available.');
}
diff --git a/docs/src/content/guides/react/remix.mdx b/docs/src/content/guides/react/remix.mdx
index 6f421e8be..5b56a6edd 100644
--- a/docs/src/content/guides/react/remix.mdx
+++ b/docs/src/content/guides/react/remix.mdx
@@ -86,7 +86,7 @@ Once the Rybbit script is installed and loaded, you can track custom events from
export default function MyFeatureRoute() {
const handleButtonClick = () => {
if (typeof window !== "undefined" && window.rybbit) {
- window.rybbit.trackEvent('remix_feature_click', { feature: 'Special Offer' });
+ window.rybbit.event('remix_feature_click', { feature: 'Special Offer' });
}
};
diff --git a/docs/src/content/guides/react/vite-cra.mdx b/docs/src/content/guides/react/vite-cra.mdx
index 0e9884ba0..1a0fa9ace 100644
--- a/docs/src/content/guides/react/vite-cra.mdx
+++ b/docs/src/content/guides/react/vite-cra.mdx
@@ -79,7 +79,7 @@ Once the script is installed, you can track custom events from any of your React
function MyComponent() {
const handleButtonClick = () => {
if (window.rybbit) {
- window.rybbit.trackEvent('button_click', { category: 'CTA', label: 'Learn More' });
+ window.rybbit.event('button_click', { category: 'CTA', label: 'Learn More' });
}
};
diff --git a/docs/src/content/guides/shopify.mdx b/docs/src/content/guides/shopify.mdx
index 5b6047abb..b647dc7f0 100644
--- a/docs/src/content/guides/shopify.mdx
+++ b/docs/src/content/guides/shopify.mdx
@@ -54,7 +54,7 @@ Add the following script towards the end of the file, or within a relevant produ
const rybbitProduct = {{ product | json }};
const rybbitCurrentVariant = {{ product.selected_or_first_available_variant | json }};
- window.rybbit.trackEvent('view_item', {
+ window.rybbit.event('view_item', {
item_id: rybbitCurrentVariant.sku || rybbitCurrentVariant.id,
item_name: rybbitProduct.title,
item_variant: rybbitCurrentVariant.title === 'Default Title' ? null : rybbitCurrentVariant.title,
@@ -90,7 +90,7 @@ document.addEventListener('DOMContentLoaded', function() {
quantity = parseInt(quantityInput.value, 10);
}
- window.rybbit.trackEvent('add_to_cart', {
+ window.rybbit.event('add_to_cart', {
item_id: rybbitCurrentVariant.sku || rybbitCurrentVariant.id,
item_name: rybbitProduct.title,
item_variant: rybbitCurrentVariant.title === 'Default Title' ? null : rybbitCurrentVariant.title,
@@ -149,7 +149,7 @@ document.addEventListener('DOMContentLoaded', function() {
});
});
- window.rybbit.trackEvent('begin_checkout', {
+ window.rybbit.event('begin_checkout', {
currency: rybbitCart.currency,
value: parseFloat(rybbitCart.total_price) / 100,
items: items
@@ -183,7 +183,7 @@ Scroll down to the **Order status page** section. In the **Additional scripts**
});
});
- window.rybbit.trackEvent('purchase', {
+ window.rybbit.event('purchase', {
transaction_id: rybbitCheckout.order_number,
value: parseFloat(rybbitCheckout.total_price),
tax: parseFloat(rybbitCheckout.tax_price),
diff --git a/docs/src/content/guides/svelte/sveltekit.mdx b/docs/src/content/guides/svelte/sveltekit.mdx
index 0e0c55881..4cb262ab8 100644
--- a/docs/src/content/guides/svelte/sveltekit.mdx
+++ b/docs/src/content/guides/svelte/sveltekit.mdx
@@ -85,7 +85,7 @@ From any Svelte component within your SvelteKit app, you can track custom events
<script>
function handleAction() {
if (typeof window !== 'undefined' && window.rybbit) {
- window.rybbit.trackEvent('user_action_sveltekit', { component: 'MySvelteKitComponent' });
+ window.rybbit.event('user_action_sveltekit', { component: 'MySvelteKitComponent' });
}
}
</script>
diff --git a/docs/src/content/guides/svelte/vite.mdx b/docs/src/content/guides/svelte/vite.mdx
index bec90c677..fc7d2a6e6 100644
--- a/docs/src/content/guides/svelte/vite.mdx
+++ b/docs/src/content/guides/svelte/vite.mdx
@@ -75,7 +75,7 @@ From any Svelte component, you can track custom events:
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' });
+ window.rybbit.event('user_action_svelte_vite', { component: 'MySvelteViteComponent' });
}
}
</script>
diff --git a/docs/src/content/guides/vue/nuxt.mdx b/docs/src/content/guides/vue/nuxt.mdx
index 395b0aa3d..7bce6beb9 100644
--- a/docs/src/content/guides/vue/nuxt.mdx
+++ b/docs/src/content/guides/vue/nuxt.mdx
@@ -81,7 +81,7 @@ From any Vue component within your Nuxt.js application, you can track custom eve
<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' });
+ window.rybbit.event('nuxt_interaction', { detail: 'User clicked important button' });
}
}
</script>
diff --git a/docs/src/content/guides/vue/vite.mdx b/docs/src/content/guides/vue/vite.mdx
index 862b88c60..b33950852 100644
--- a/docs/src/content/guides/vue/vite.mdx
+++ b/docs/src/content/guides/vue/vite.mdx
@@ -98,8 +98,8 @@ From any Vue component or method, you can track custom events:
<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' });
+ if (window.rybbit && typeof window.rybbit.event === 'function') {
+ window.rybbit.event('custom_vue_action', { detail: 'User performed a client-side Vue action' });
}
}
</script>
diff --git a/docs/src/content/guides/webflow.mdx b/docs/src/content/guides/webflow.mdx
index 0fbdfa329..f51b101fc 100644
--- a/docs/src/content/guides/webflow.mdx
+++ b/docs/src/content/guides/webflow.mdx
@@ -57,7 +57,7 @@ You can track custom events in Webflow by adding custom JavaScript code, either
if (specialButton) {
specialButton.addEventListener('click', function() {
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('webflow_button_click', {
+ window.rybbit.event('webflow_button_click', {
button_id: 'my-special-button',
button_text: specialButton.textContent || specialButton.innerText,
page_path: window.location.pathname
@@ -89,7 +89,7 @@ You can track custom events in Webflow by adding custom JavaScript code, either
// 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', {
+ window.rybbit.event('webflow_form_submit', {
form_id: 'contact-form',
// You can try to get form field values here if needed, but be mindful of PII.
});
diff --git a/docs/src/content/guides/woocommerce.mdx b/docs/src/content/guides/woocommerce.mdx
index acb5dfb21..4108ebb4d 100644
--- a/docs/src/content/guides/woocommerce.mdx
+++ b/docs/src/content/guides/woocommerce.mdx
@@ -44,7 +44,7 @@ function rybbit_track_view_product() {
?>
<script type="text/javascript">
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('view_item', <?php echo json_encode($product_data); ?>);
+ window.rybbit.event('view_item', <?php echo json_encode($product_data); ?>);
}
</script>
<?php
@@ -87,7 +87,7 @@ function rybbit_track_add_to_cart_script() {
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);
+ window.rybbit.event('add_to_cart', eventData);
}
});
}
@@ -108,7 +108,7 @@ function rybbit_ajax_add_to_cart_tracker() {
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', {
+ window.rybbit.event('add_to_cart', {
item_id: productId,
quantity: quantity,
source: 'ajax_add_to_cart'
@@ -153,7 +153,7 @@ function rybbit_track_begin_checkout() {
?>
<script type="text/javascript">
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('begin_checkout', <?php echo json_encode($checkout_data); ?>);
+ window.rybbit.event('begin_checkout', <?php echo json_encode($checkout_data); ?>);
}
</script>
<?php
@@ -198,7 +198,7 @@ function rybbit_track_purchase( $order_id ) {
?>
<script type="text/javascript">
if (typeof window.rybbit !== 'undefined') {
- window.rybbit.trackEvent('purchase', <?php echo json_encode($purchase_data); ?>);
+ window.rybbit.event('purchase', <?php echo json_encode($purchase_data); ?>);
}
</script>
<?php