Skip to content

Commit c40ece0

Browse files
committed
Update event tracking for demo and GitHub actions
- Modified trackAdEvent function to include "github" as a valid event name for tracking. - Updated CustomHeader and GitHubStarButton components to trigger trackAdEvent for demo and GitHub interactions, enhancing analytics capabilities. - Adjusted conditions in trackAdEvent to ensure proper tracking for custom events.
1 parent f5b698e commit c40ece0

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

client/src/lib/trackAdEvent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function trackAdEvent(eventName: "signup" | "checkout" | "login", eventDa
2929
window.fbq("track", "InitiateCheckout", eventData);
3030
}
3131
// Track custom events for other button clicks
32-
if (!["signup", "demo"].some(event => eventName.toLowerCase().includes(event))) {
32+
if (!["demo"].some(event => eventName.toLowerCase().includes(event))) {
3333
window.fbq("trackCustom", eventName, eventData);
3434
}
3535
}

docs-v2/src/components/CustomHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function CustomHeader() {
3636
target="_blank"
3737
rel="noopener noreferrer"
3838
className="text-sm font-base text-neutral-400 hover:text-white transition-colors"
39+
onClick={() => trackAdEvent("demo", { location: "header" })}
3940
>
4041
Demo
4142
</a>
@@ -64,6 +65,7 @@ export function CustomHeader() {
6465
rel="noopener noreferrer"
6566
className="text-neutral-400 hover:text-white transition-colors"
6667
aria-label="GitHub"
68+
onClick={() => trackAdEvent("github", { location: "header" })}
6769
>
6870
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
6971
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />

docs-v2/src/components/GitHubStarButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useState, useEffect } from "react";
44
import { Star } from "lucide-react";
5+
import { trackAdEvent } from "../lib/trackAdEvent";
56

67
export function GitHubStarButton() {
78
const [starCount, setStarCount] = useState<string | null>(null);
@@ -28,7 +29,7 @@ export function GitHubStarButton() {
2829
}, []);
2930

3031
return (
31-
<div className="mb-6 md:mb-8">
32+
<div className="mb-6 md:mb-8" onClick={() => trackAdEvent("github")}>
3233
<a
3334
href="https://github.com/rybbit-io/rybbit"
3435
target="_blank"

docs-v2/src/components/TrackedButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Link from "next/link";
55

66
interface TrackedButtonProps {
77
href: string;
8-
eventName: "signup" | "demo" | "login";
8+
eventName: "signup" | "demo" | "login" | "github";
99
eventProps: Record<string, string | number | boolean>;
1010
className: string;
1111
children: React.ReactNode;

docs-v2/src/lib/trackAdEvent.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ declare global {
66
}
77
}
88

9-
export function trackAdEvent(eventName: "signup" | "demo" | "login", eventData?: Record<string, any>) {
9+
export function trackAdEvent(eventName: "signup" | "demo" | "login" | "github", eventData?: Record<string, any>) {
1010
// Track X/Twitter lead event for signup-related buttons
1111
if (typeof window !== "undefined" && window.twq) {
1212
if (["signup"].some(event => eventName.toLowerCase().includes(event))) {
@@ -15,6 +15,9 @@ export function trackAdEvent(eventName: "signup" | "demo" | "login", eventData?:
1515
if (["demo"].some(event => eventName.toLowerCase().includes(event))) {
1616
window.twq("event", "tw-qj0po-qje0f", {});
1717
}
18+
if (["login"].some(event => eventName.toLowerCase().includes(event))) {
19+
window.twq("event", "tw-qj0po-qjjy6", {});
20+
}
1821
}
1922

2023
// Track Facebook lead event
@@ -26,8 +29,11 @@ export function trackAdEvent(eventName: "signup" | "demo" | "login", eventData?:
2629
// window.fbq("track", "ViewContent", eventData);
2730
// }
2831
// Track custom events for other button clicks
29-
if (!["signup", "demo"].some(event => eventName.toLowerCase().includes(event))) {
32+
if (!["demo"].some(event => eventName.toLowerCase().includes(event))) {
3033
window.fbq("trackCustom", eventName, eventData);
3134
}
35+
if (["github"].some(event => eventName.toLowerCase().includes(event))) {
36+
window.fbq("trackCustom", "GitHub", eventData);
37+
}
3238
}
3339
}

0 commit comments

Comments
 (0)