Add Matomo analytics tracking with Suspense fix
- Created MatomoAnalytics component with page view and event tracking - Fixed Next.js build issue by wrapping useSearchParams in Suspense - Added tracking for user interactions: - Search functionality - Table sorting - Filter changes (material, finish, color) - Dark mode toggles - Admin login success/failure - Admin filament create/update actions - Updated Amplify environment variables via AWS CLI - Analytics URL: https://analytics.demirix.dev (Site ID: 7) - Only loads when environment variables are set 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useState, useMemo, useEffect } from 'react';
|
||||
import { Filament } from '@/src/types/filament';
|
||||
import { EnhancedFilters } from './EnhancedFilters';
|
||||
import { colorService } from '@/src/services/api';
|
||||
import { trackEvent } from './MatomoAnalytics';
|
||||
|
||||
interface FilamentTableV2Props {
|
||||
filaments: Filament[];
|
||||
@@ -114,6 +115,7 @@ const FilamentTableV2: React.FC<FilamentTableV2Props> = ({ filaments }) => {
|
||||
setSortField(field);
|
||||
setSortOrder('asc');
|
||||
}
|
||||
trackEvent('Table', 'Sort', field);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -125,7 +127,12 @@ const FilamentTableV2: React.FC<FilamentTableV2Props> = ({ filaments }) => {
|
||||
type="text"
|
||||
placeholder="Pretraži po materijalu, boji..."
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setSearchTerm(e.target.value);
|
||||
if (e.target.value) {
|
||||
trackEvent('Search', 'Filament Search', e.target.value);
|
||||
}
|
||||
}}
|
||||
className="w-full px-4 py-2 pl-10 pr-4 text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:border-blue-500"
|
||||
/>
|
||||
<svg className="absolute left-3 top-2.5 h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
|
||||
Reference in New Issue
Block a user