feat: implement core platform features including business directory, admin dashboard, authentication, and API infrastructure
Some checks failed
Build and Push App / build (push) Failing after 16m2s
Some checks failed
Build and Push App / build (push) Failing after 16m2s
This commit is contained in:
@@ -31,12 +31,24 @@ export default function AnalyticsTracker() {
|
||||
|
||||
// 1. Track Page Views
|
||||
useEffect(() => {
|
||||
// Attempt to get userId from localStorage (common in this app's auth setup)
|
||||
let userId = null;
|
||||
try {
|
||||
const userStr = localStorage.getItem('user');
|
||||
if (userStr) {
|
||||
const user = JSON.parse(userStr);
|
||||
userId = user.id;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
sendEvent({
|
||||
type: 'PAGE_VIEW',
|
||||
path: pathname,
|
||||
metadata: {
|
||||
userAgent: navigator.userAgent,
|
||||
screen: `${window.innerWidth}x${window.innerHeight}`,
|
||||
referrer: document.referrer,
|
||||
userId: userId
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user