Skip to content

Instantly share code, notes, and snippets.

View yahyajideh's full-sized avatar

Yahya Jideh yahyajideh

View GitHub Profile
@yahyajideh
yahyajideh / layout.tsx
Created October 18, 2025 03:26
HubSpot tracker usage in App Layout (NextJs App Router)
// app/layout.tsx
import { Suspense } from 'react'
import HubspotTracker from '@/components/main/HubSpotTracker'
export default function RootLayout({
children
}: {
children: React.ReactNode
}) {
return (
@yahyajideh
yahyajideh / HubSpotTracker.tsx
Last active October 18, 2025 03:24
Hubspot Tracker
// components/main/HubSpotTracker.tsx
"use client";
import { useEffect, useState } from "react";
import { usePathname, useSearchParams } from "next/navigation";
import Script from "next/script";
declare global {
interface Window {
_hsq: any[];
import { Client } from "@hubspot/api-client";
import { FilterOperatorEnum } from "@hubspot/api-client/lib/codegen/crm/contacts";
// import { retryRequest } from "../utils/errorHandler";
class HubSpotService {
private hubspotClient: Client;
constructor(accessToken: string) {
this.hubspotClient = new Client({ accessToken });
}