Forward and back scarf fires

This commit is contained in:
Connor Yoh 2025-08-28 11:52:32 +01:00
parent 2cada1697c
commit fe1c44fdaa

View File

@ -6,6 +6,7 @@ import { useEffect, useCallback } from 'react';
import { WorkbenchType, ToolId } from '../types/navigation'; import { WorkbenchType, ToolId } from '../types/navigation';
import { parseToolRoute, updateToolRoute, clearToolRoute } from '../utils/urlRouting'; import { parseToolRoute, updateToolRoute, clearToolRoute } from '../utils/urlRouting';
import { ToolRegistry } from '../data/toolsTaxonomy'; import { ToolRegistry } from '../data/toolsTaxonomy';
import { firePixel } from '../utils/scarfTracking';
/** /**
* Hook to sync workbench and tool with URL using registry * Hook to sync workbench and tool with URL using registry
@ -54,6 +55,10 @@ export function useNavigationUrlSync(
const handlePopState = () => { const handlePopState = () => {
const route = parseToolRoute(registry); const route = parseToolRoute(registry);
if (route.toolId !== selectedTool) { if (route.toolId !== selectedTool) {
// Fire pixel for back/forward navigation
const currentPath = window.location.pathname;
firePixel(currentPath);
if (route.toolId) { if (route.toolId) {
handleToolSelect(route.toolId); handleToolSelect(route.toolId);
} else { } else {