2.9.3
Tracking Refreshed cached files
This commit is contained in:
@@ -36,6 +36,16 @@ import { useColumnPopup } from './useColumnPopup.js';
|
||||
import { useTableScroll } from './useTableScroll.js';
|
||||
import { getActiveEvents, getLensEvent } from '../events.js';
|
||||
|
||||
function track(event, profile) {
|
||||
try {
|
||||
fetch('track.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(profile ? { event, profile } : { event }),
|
||||
}).catch(() => {});
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
|
||||
export function useAppState() {
|
||||
|
||||
// ── 1. LOCATION ──────────────────────────────────────────────────────
|
||||
@@ -66,6 +76,8 @@ export function useAppState() {
|
||||
|
||||
const { forecast, airQuality, loading, error, now, fetchedAt, liveElev } = useForecast(location, isPro);
|
||||
|
||||
useEffect(() => { track('visit'); }, []);
|
||||
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [searchResults, setSearchResults] = useState([]);
|
||||
const [searching, setSearching] = useState(false);
|
||||
@@ -150,6 +162,7 @@ export function useAppState() {
|
||||
const toggleCol = (col) => setVisibleCols(prev => ({ ...prev, [col]: !prev[col] }));
|
||||
|
||||
const activateProfile = (key) => {
|
||||
track('profile', key);
|
||||
const profile = FILTER_PROFILES[key];
|
||||
try { localStorage.setItem('sunscope_profile', key); } catch (e) { /* ignore */ }
|
||||
setActiveProfile(key);
|
||||
|
||||
Reference in New Issue
Block a user