diff --git a/src/pages/event.js b/src/pages/event.js index 5dcd744..1abbb1e 100644 --- a/src/pages/event.js +++ b/src/pages/event.js @@ -83,6 +83,7 @@ export function Event() { const [ensNames, setEnsNames] = useState([]); const [canDownloadCsv, setCanDownloadCsv] = useState(CSV_STATUS.NoTokens); const [tableIsLoading, setTableIsLoading] = useState(true); + const [trackedEvent, setTrackedEvent] = useState(null); const pageCount = useMemo( () => event.tokenCount % 50 !== 0 @@ -120,13 +121,20 @@ export function Event() { }, []); useEffect(() => { - if (succeededLoadingEvent() && !tableIsLoading && event && event?.name) { + if ( + succeededLoadingEvent() && + event && + event?.name && + event?.id && + (!trackedEvent || trackedEvent !== event.id) + ) { trackPageView({ href: window.location.href, documentTitle: `POAP Gallery - Event - ${event.name}`, }); + setTrackedEvent(event.id); } - }, [event, succeededLoadingEvent, tableIsLoading]); + }, [event, succeededLoadingEvent, trackedEvent, setTrackedEvent]); useEffect(() => { // Get new batch of tokens