diff --git a/app/events/[slug]/page.tsx b/app/events/[slug]/page.tsx
index e3327095..9d270daf 100644
--- a/app/events/[slug]/page.tsx
+++ b/app/events/[slug]/page.tsx
@@ -98,11 +98,11 @@ export default function EventPage() {
// Track analytics
console.log('[EventPage] About to call useAnalyticsTracking with slug:', slug)
- const { trackClick } = useAnalyticsTracking({
+ useAnalyticsTracking({
eventSlug: slug,
trackView: true,
})
- console.log('[EventPage] useAnalyticsTracking returned:', { trackClick })
+ console.log('[EventPage] useAnalyticsTracking initialized')
useEffect(() => {
const fetchEvent = async () => {
@@ -143,9 +143,6 @@ export default function EventPage() {
const handleRegister = async () => {
if (!event) return
- // Track click on registration button
- trackClick()
-
setRegistering(true)
try {
if (event.payment === 'Required' || event.payment === 'Paid') {
diff --git a/app/hackathons/[id]/page.tsx b/app/hackathons/[id]/page.tsx
index ed89ecb5..aff968c9 100644
--- a/app/hackathons/[id]/page.tsx
+++ b/app/hackathons/[id]/page.tsx
@@ -122,7 +122,7 @@ export default function HackathonDetailPage() {
const { hackathon, loading: isLoading, error: fetchError } = useHackathon(slug)
// Track analytics
- const { trackClick } = useAnalyticsTracking({
+ useAnalyticsTracking({
hackathonId: slug,
trackView: true,
})
@@ -186,9 +186,6 @@ export default function HackathonDetailPage() {
const handleRegister = async () => {
if (!hackathon) return
- // Track click on registration button
- trackClick()
-
setRegistering(true)
try {
const response = await fetch(`/api/hackathons/${slug}/register`, {
diff --git a/components/dashboard/AnalyticsCharts.tsx b/components/dashboard/AnalyticsCharts.tsx
index a91fb28f..25a95109 100644
--- a/components/dashboard/AnalyticsCharts.tsx
+++ b/components/dashboard/AnalyticsCharts.tsx
@@ -20,7 +20,7 @@ import { Button } from '@/components/ui/button'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { CompanyAnalytics } from '@/types/company'
import { format } from 'date-fns'
-import { TrendingUp, Eye, MousePointerClick, Users, Calendar, Download, Trophy } from 'lucide-react'
+import { TrendingUp, Eye, Users, Calendar, Download, Trophy } from 'lucide-react'
interface AnalyticsChartsProps {
analytics: CompanyAnalytics[]
@@ -32,7 +32,6 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
const [chartType, setChartType] = useState<'line' | 'bar' | 'area'>('line')
const [actualStats, setActualStats] = React.useState<{
views: number
- clicks: number
registrations: number
eventsPublished: number
eventsCreated: number
@@ -54,7 +53,6 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
const allEvents = eventsData.events || []
const approvedEvents = allEvents.filter((e: any) => e.approval_status === 'approved')
const eventViews = approvedEvents.reduce((sum: number, e: any) => sum + (e.views || 0), 0)
- const eventClicks = approvedEvents.reduce((sum: number, e: any) => sum + (e.clicks || 0), 0)
const eventRegs = approvedEvents.reduce((sum: number, e: any) => sum + (e.registered || 0), 0)
// Fetch hackathons
@@ -63,13 +61,11 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
const allHackathons = hackathonsData.hackathons || []
const approvedHackathons = allHackathons.filter((h: any) => h.approval_status === 'approved')
const hackathonViews = approvedHackathons.reduce((sum: number, h: any) => sum + (h.views || 0), 0)
- const hackathonClicks = approvedHackathons.reduce((sum: number, h: any) => sum + (h.clicks || 0), 0)
const hackathonRegs = approvedHackathons.reduce((sum: number, h: any) => sum + (h.registered || 0), 0)
/* eslint-enable @typescript-eslint/no-explicit-any */
setActualStats({
views: eventViews + hackathonViews,
- clicks: eventClicks + hackathonClicks,
registrations: eventRegs + hackathonRegs,
eventsPublished: approvedEvents.length,
eventsCreated: allEvents.length,
@@ -87,23 +83,17 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
// Calculate scaling factor to adjust historical data to match current reality
const analyticsHistoricalTotal = analytics.reduce((sum, record) => sum + record.total_views, 0)
const actualCurrentTotal = actualStats?.views ?? analyticsHistoricalTotal
-
- const analyticsHistoricalClicks = analytics.reduce((sum, record) => sum + record.total_clicks, 0)
- const actualCurrentClicks = actualStats?.clicks ?? analyticsHistoricalClicks
// Transform analytics data for charts with proportional distribution
// First pass: calculate proportions and floor values
const chartDataWithRemainder = analytics.map((record) => {
const viewsProportion = analyticsHistoricalTotal > 0 ? (record.total_views / analyticsHistoricalTotal) * actualCurrentTotal : 0
- const clicksProportion = analyticsHistoricalClicks > 0 ? (record.total_clicks / analyticsHistoricalClicks) * actualCurrentClicks : 0
return {
date: format(new Date(record.date), 'MMM dd'),
fullDate: record.date,
views: Math.floor(viewsProportion),
viewsRemainder: viewsProportion - Math.floor(viewsProportion),
- clicks: Math.floor(clicksProportion),
- clicksRemainder: clicksProportion - Math.floor(clicksProportion),
registrations: record.total_registrations,
eventsCreated: record.events_created,
eventsPublished: record.events_published,
@@ -115,9 +105,6 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
// Second pass: distribute remaining views to days with highest remainders
const totalFlooredViews = chartDataWithRemainder.reduce((sum, d) => sum + d.views, 0)
const viewsToDistribute = actualCurrentTotal - totalFlooredViews
-
- const totalFlooredClicks = chartDataWithRemainder.reduce((sum, d) => sum + d.clicks, 0)
- const clicksToDistribute = actualCurrentClicks - totalFlooredClicks
// Sort by remainder and add 1 to top N days
const sortedByViewsRemainder = [...chartDataWithRemainder].sort((a, b) => b.viewsRemainder - a.viewsRemainder)
@@ -126,15 +113,9 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
chartDataWithRemainder[index].views += 1
}
- const sortedByClicksRemainder = [...chartDataWithRemainder].sort((a, b) => b.clicksRemainder - a.clicksRemainder)
- for (let i = 0; i < clicksToDistribute && i < sortedByClicksRemainder.length; i++) {
- const index = chartDataWithRemainder.indexOf(sortedByClicksRemainder[i])
- chartDataWithRemainder[index].clicks += 1
- }
-
// Final chart data without remainder fields
// eslint-disable-next-line @typescript-eslint/no-unused-vars
- const chartData = chartDataWithRemainder.map(({ viewsRemainder, clicksRemainder, ...rest }) => rest)
+ const chartData = chartDataWithRemainder.map(({ viewsRemainder, ...rest }) => rest)
// Calculate totals from analytics (for published counts)
const analyticsTotals = analytics.reduce(
@@ -153,7 +134,6 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
// Use actual stats if available, otherwise fall back to analytics
const totals = {
views: actualStats?.views ?? analyticsTotals.views,
- clicks: actualStats?.clicks ?? analyticsTotals.clicks,
registrations: actualStats?.registrations ?? analyticsTotals.registrations,
eventsCreated: actualStats?.eventsCreated ?? analyticsTotals.eventsCreated,
eventsPublished: actualStats?.eventsPublished ?? analyticsTotals.eventsPublished,
@@ -163,21 +143,17 @@ export function AnalyticsCharts({ analytics, dateRange, onExport }: AnalyticsCha
// Calculate averages
const avgViews = analytics.length > 0 ? Math.round(totals.views / analytics.length) : 0
- const avgClicks = analytics.length > 0 ? Math.round(totals.clicks / analytics.length) : 0
const avgRegistrations =
analytics.length > 0 ? Math.round(totals.registrations / analytics.length) : 0
- // Calculate click-through rate
- const ctr = totals.views > 0 ? ((totals.clicks / totals.views) * 100).toFixed(2) : '0.00'
-
- // Calculate conversion rate (registrations / clicks)
+ // Calculate conversion rate (registrations / views)
const conversionRate =
- totals.clicks > 0 ? ((totals.registrations / totals.clicks) * 100).toFixed(2) : '0.00'
+ totals.views > 0 ? ((totals.registrations / totals.views) * 100).toFixed(2) : '0.00'
return (
{/* Summary Stats */}
-
+
-
{/* Engagement Metrics */}
-
-
-
- Click-Through Rate
- Clicks per view
-
-
- {ctr}%
-
- {totals.clicks.toLocaleString()} clicks from {totals.views.toLocaleString()} views
-
-
-
-
+
Conversion Rate
- Registrations per click
+ Registrations per view
{conversionRate}%
{totals.registrations.toLocaleString()} registrations from{' '}
- {totals.clicks.toLocaleString()} clicks
+ {totals.views.toLocaleString()} views
@@ -621,7 +577,6 @@ function EventPerformanceComparison({ analytics }: EventPerformanceComparisonPro
const [eventStats, setEventStats] = React.useState<{
totalEvents: number
totalViews: number
- totalClicks: number
totalRegistrations: number
} | null>(null)
@@ -642,7 +597,6 @@ function EventPerformanceComparison({ analytics }: EventPerformanceComparisonPro
// Calculate actual totals from events table
const totalViews = approvedEvents.reduce((sum: number, e: any) => sum + (e.views || 0), 0)
- const totalClicks = approvedEvents.reduce((sum: number, e: any) => sum + (e.clicks || 0), 0)
// Get registrations count
const regResponse = await fetch(`/api/companies/${companySlug}/events?status=all&limit=100`)
@@ -653,7 +607,6 @@ function EventPerformanceComparison({ analytics }: EventPerformanceComparisonPro
setEventStats({
totalEvents: approvedEvents.length,
totalViews,
- totalClicks,
totalRegistrations
})
} catch (error) {
@@ -667,12 +620,10 @@ function EventPerformanceComparison({ analytics }: EventPerformanceComparisonPro
// Use fetched stats if available, otherwise fall back to analytics data
const totalEvents = eventStats?.totalEvents ?? analytics.reduce((sum, record) => sum + record.events_published, 0)
const totalViews = eventStats?.totalViews ?? 0
- const totalClicks = eventStats?.totalClicks ?? 0
const totalRegistrations = eventStats?.totalRegistrations ?? 0
// Calculate averages per event
const avgViewsPerEvent = totalEvents > 0 ? Math.round(totalViews / totalEvents) : 0
- const avgClicksPerEvent = totalEvents > 0 ? Math.round(totalClicks / totalEvents) : 0
const avgRegistrationsPerEvent = totalEvents > 0 ? Math.round(totalRegistrations / totalEvents) : 0
if (totalEvents === 0) {
@@ -705,7 +656,7 @@ function EventPerformanceComparison({ analytics }: EventPerformanceComparisonPro
Average performance per published event
-
+
Avg Views per Event
@@ -717,17 +668,6 @@ function EventPerformanceComparison({ analytics }: EventPerformanceComparisonPro
-
-
-
Avg Clicks per Event
-
-
-
{avgClicksPerEvent.toLocaleString()}
-
- {totalClicks.toLocaleString()} total clicks across {totalEvents} {totalEvents === 1 ? 'event' : 'events'}
-
-
-
Avg Registrations per Event
@@ -753,8 +693,8 @@ function EventPerformanceComparison({ analytics }: EventPerformanceComparisonPro
: `You have published ${totalEvents} events in this period.`}{' '}
{avgViewsPerEvent > 100 && 'Your events are getting great visibility! '}
{avgRegistrationsPerEvent > 10 && 'Strong registration rates indicate high engagement. '}
- {avgClicksPerEvent < avgViewsPerEvent * 0.1 &&
- 'Consider improving your event descriptions to increase click-through rates.'}
+ {avgViewsPerEvent > 0 && avgRegistrationsPerEvent < avgViewsPerEvent * 0.1 &&
+ 'Consider improving your event descriptions to increase conversion rates.'}
@@ -773,7 +713,6 @@ function HackathonPerformanceComparison({ analytics }: HackathonPerformanceCompa
const [hackathonStats, setHackathonStats] = React.useState<{
totalHackathons: number
totalViews: number
- totalClicks: number
totalRegistrations: number
} | null>(null)
@@ -794,14 +733,12 @@ function HackathonPerformanceComparison({ analytics }: HackathonPerformanceCompa
// Calculate actual totals from hackathons table
const totalViews = approvedHackathons.reduce((sum: number, h: any) => sum + (h.views || 0), 0)
- const totalClicks = approvedHackathons.reduce((sum: number, h: any) => sum + (h.clicks || 0), 0)
const totalRegistrations = approvedHackathons.reduce((sum: number, h: any) => sum + (h.registered || 0), 0)
/* eslint-enable @typescript-eslint/no-explicit-any */
setHackathonStats({
totalHackathons: approvedHackathons.length,
totalViews,
- totalClicks,
totalRegistrations
})
} catch (error) {
@@ -815,12 +752,10 @@ function HackathonPerformanceComparison({ analytics }: HackathonPerformanceCompa
// Use fetched stats if available, otherwise fall back to analytics data
const totalHackathons = hackathonStats?.totalHackathons ?? analytics.reduce((sum, record) => sum + record.hackathons_published, 0)
const totalViews = hackathonStats?.totalViews ?? 0
- const totalClicks = hackathonStats?.totalClicks ?? 0
const totalRegistrations = hackathonStats?.totalRegistrations ?? 0
// Calculate averages per hackathon
const avgViewsPerHackathon = totalHackathons > 0 ? Math.round(totalViews / totalHackathons) : 0
- const avgClicksPerHackathon = totalHackathons > 0 ? Math.round(totalClicks / totalHackathons) : 0
const avgRegistrationsPerHackathon = totalHackathons > 0 ? Math.round(totalRegistrations / totalHackathons) : 0
if (totalHackathons === 0) {
@@ -865,17 +800,6 @@ function HackathonPerformanceComparison({ analytics }: HackathonPerformanceCompa
-
-
-
Avg Clicks per Hackathon
-
-
-
{avgClicksPerHackathon.toLocaleString()}
-
- {totalClicks.toLocaleString()} total clicks across {totalHackathons} {totalHackathons === 1 ? 'hackathon' : 'hackathons'}
-
-
-
Avg Registrations per Hackathon
@@ -901,8 +825,8 @@ function HackathonPerformanceComparison({ analytics }: HackathonPerformanceCompa
: `You have published ${totalHackathons} hackathons in this period.`}{' '}
{avgViewsPerHackathon > 150 && 'Your hackathons are attracting strong interest! '}
{avgRegistrationsPerHackathon > 15 && 'Excellent team registration rates! '}
- {avgClicksPerHackathon < avgViewsPerHackathon * 0.1 &&
- 'Consider enhancing your hackathon descriptions to boost engagement.'}
+ {avgViewsPerHackathon > 0 && avgRegistrationsPerHackathon < avgViewsPerHackathon * 0.1 &&
+ 'Consider enhancing your hackathon descriptions to boost conversion rates.'}
diff --git a/components/dashboard/CompanyDashboard.tsx b/components/dashboard/CompanyDashboard.tsx
index 173636fd..6f2fc51b 100644
--- a/components/dashboard/CompanyDashboard.tsx
+++ b/components/dashboard/CompanyDashboard.tsx
@@ -30,17 +30,14 @@ interface CompanyDashboardStats {
totalHackathons: number
totalRegistrations: number
totalViews: number
- totalClicks: number
pendingApprovals: number
eventMetrics: {
views: number
registrations: number
- clicks: number
}
hackathonMetrics: {
views: number
registrations: number
- clicks: number
}
recentChange?: {
events: number
@@ -189,49 +186,35 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) {
const totalRegistrations = eventRegistrations + hackathonRegistrations
/* eslint-enable @typescript-eslint/no-explicit-any */
- // Calculate actual views and clicks from events and hackathons
+ // Calculate actual views from events and hackathons
/* eslint-disable @typescript-eslint/no-explicit-any */
const eventViews = eventsData.events?.reduce(
(sum: number, e: any) => sum + (e.views || 0),
0
) || 0
- const eventClicks = eventsData.events?.reduce(
- (sum: number, e: any) => sum + (e.clicks || 0),
- 0
- ) || 0
-
const hackathonViews = hackathonsData.hackathons?.reduce(
(sum: number, h: any) => sum + (h.views || 0),
0
) || 0
-
- const hackathonClicks = hackathonsData.hackathons?.reduce(
- (sum: number, h: any) => sum + (h.clicks || 0),
- 0
- ) || 0
/* eslint-enable @typescript-eslint/no-explicit-any */
- // Use actual views and clicks from events/hackathons tables, not analytics
+ // Use actual views from events/hackathons tables, not analytics
const totalViews = eventViews + hackathonViews
- const totalClicks = eventClicks + hackathonClicks
setStats({
totalEvents: approvedEvents.length,
totalHackathons: approvedHackathons.length,
totalRegistrations: totalRegistrations,
totalViews: totalViews,
- totalClicks: totalClicks,
pendingApprovals: pendingEvents.length,
eventMetrics: {
views: eventViews,
registrations: eventRegistrations,
- clicks: eventClicks,
},
hackathonMetrics: {
views: hackathonViews,
registrations: hackathonRegistrations,
- clicks: hackathonClicks,
},
recentChange: {
events: 0, // Could calculate from analytics
@@ -442,15 +425,6 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) {
{stats.eventMetrics.registrations.toLocaleString()}
-
-
-
- {stats.eventMetrics.clicks.toLocaleString()}
-
-
{stats.eventMetrics.views > 0 && (
@@ -494,15 +468,6 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) {
{stats.hackathonMetrics.registrations.toLocaleString()}
-
-
-
- {stats.hackathonMetrics.clicks.toLocaleString()}
-
-
{stats.hackathonMetrics.views > 0 && (
diff --git a/delete-test-company.js b/delete-test-company.js
deleted file mode 100644
index 746c1384..00000000
--- a/delete-test-company.js
+++ /dev/null
@@ -1,232 +0,0 @@
-const { createClient } = require('@supabase/supabase-js')
-
-const supabaseUrl = 'https://ocnorlktyfswjqgvzrve.supabase.co'
-const supabaseKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9jbm9ybGt0eWZzd2pxZ3Z6cnZlIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1MDQzNTY4NSwiZXhwIjoyMDY2MDExNjg1fQ.QP6L8TLHMk5dreFc_OTdeLzk-adB90WL9LSlmQgoRCs'
-
-const supabase = createClient(supabaseUrl, supabaseKey)
-
-async function deleteTestCompany() {
- const companySlug = 'vertex-digital-solutions'
-
- console.log('='.repeat(80))
- console.log('DELETING TEST COMPANY: Vertex Digital Solutions')
- console.log('='.repeat(80))
- console.log()
-
- try {
- // First, get the company to confirm it exists
- const { data: company, error: fetchError } = await supabase
- .from('companies')
- .select('id, name, slug')
- .eq('slug', companySlug)
- .single()
-
- if (fetchError || !company) {
- console.log('❌ Company not found or already deleted')
- return
- }
-
- console.log('Found company:')
- console.log(`- ID: ${company.id}`)
- console.log(`- Name: ${company.name}`)
- console.log(`- Slug: ${company.slug}`)
- console.log()
-
- // Get counts before deletion
- const { count: eventsCount } = await supabase
- .from('events')
- .select('*', { count: 'exact', head: true })
- .eq('company_id', company.id)
-
- const { count: hackathonsCount } = await supabase
- .from('hackathons')
- .select('*', { count: 'exact', head: true })
- .eq('company_id', company.id)
-
- const { count: membersCount } = await supabase
- .from('company_members')
- .select('*', { count: 'exact', head: true })
- .eq('company_id', company.id)
-
- const { count: analyticsCount } = await supabase
- .from('company_analytics')
- .select('*', { count: 'exact', head: true })
- .eq('company_id', company.id)
-
- console.log('Data to be deleted:')
- console.log(`- Events: ${eventsCount || 0}`)
- console.log(`- Hackathons: ${hackathonsCount || 0}`)
- console.log(`- Members: ${membersCount || 0}`)
- console.log(`- Analytics Records: ${analyticsCount || 0}`)
- console.log()
-
- console.log('⚠️ WARNING: This will permanently delete all data!')
- console.log('Press Ctrl+C within 5 seconds to cancel...')
- console.log()
-
- // Wait 5 seconds
- await new Promise(resolve => setTimeout(resolve, 5000))
-
- console.log('Proceeding with deletion...')
- console.log()
-
- // Step 1: Get all events and hackathons IDs
- const { data: events } = await supabase
- .from('events')
- .select('id')
- .eq('company_id', company.id)
-
- const { data: hackathons } = await supabase
- .from('hackathons')
- .select('id')
- .eq('company_id', company.id)
-
- const eventIds = events?.map(e => e.id) || []
- const hackathonIds = hackathons?.map(h => h.id) || []
-
- // Step 2: Delete event registrations
- if (eventIds.length > 0) {
- console.log('Step 1: Deleting event registrations...')
- const { error: eventRegsError } = await supabase
- .from('event_registrations')
- .delete()
- .in('event_id', eventIds)
-
- if (eventRegsError && eventRegsError.code !== 'PGRST116') {
- console.error('Warning: Error deleting event registrations:', eventRegsError)
- } else {
- console.log('✓ Event registrations deleted')
- }
- }
-
- // Step 3: Delete hackathon registrations
- if (hackathonIds.length > 0) {
- console.log('Step 2: Deleting hackathon registrations...')
- const { error: hackRegsError } = await supabase
- .from('hackathon_registrations')
- .delete()
- .in('hackathon_id', hackathonIds)
-
- if (hackRegsError && hackRegsError.code !== 'PGRST116') {
- console.error('Warning: Error deleting hackathon registrations:', hackRegsError)
- } else {
- console.log('✓ Hackathon registrations deleted')
- }
- }
-
- // Step 4: Delete event_audit_log records
- console.log('Step 3: Deleting event audit logs...')
- const { error: auditError } = await supabase
- .from('event_audit_log')
- .delete()
- .eq('company_id', company.id)
-
- if (auditError && auditError.code !== 'PGRST116') {
- console.error('Warning: Error deleting audit logs:', auditError)
- } else {
- console.log('✓ Audit logs deleted')
- }
-
- // Step 5: Delete event_moderation_log records
- console.log('Step 4: Deleting moderation logs...')
- const { error: moderationError } = await supabase
- .from('event_moderation_log')
- .delete()
- .eq('company_id', company.id)
-
- if (moderationError && moderationError.code !== 'PGRST116') {
- console.error('Warning: Error deleting moderation logs:', moderationError)
- } else {
- console.log('✓ Moderation logs deleted')
- }
-
- // Step 6: Delete events
- if (eventIds.length > 0) {
- console.log('Step 5: Deleting events...')
- const { error: eventsError } = await supabase
- .from('events')
- .delete()
- .eq('company_id', company.id)
-
- if (eventsError) {
- console.error('❌ Error deleting events:', eventsError)
- return
- }
- console.log('✓ Events deleted')
- }
-
- // Step 7: Delete hackathons
- if (hackathonIds.length > 0) {
- console.log('Step 6: Deleting hackathons...')
- const { error: hackathonsError } = await supabase
- .from('hackathons')
- .delete()
- .eq('company_id', company.id)
-
- if (hackathonsError) {
- console.error('❌ Error deleting hackathons:', hackathonsError)
- return
- }
- console.log('✓ Hackathons deleted')
- }
-
- // Step 8: Delete company analytics
- console.log('Step 7: Deleting analytics...')
- const { error: analyticsError } = await supabase
- .from('company_analytics')
- .delete()
- .eq('company_id', company.id)
-
- if (analyticsError && analyticsError.code !== 'PGRST116') {
- console.error('Warning: Error deleting analytics:', analyticsError)
- } else {
- console.log('✓ Analytics deleted')
- }
-
- // Step 9: Delete company members
- console.log('Step 8: Deleting company members...')
- const { error: membersError } = await supabase
- .from('company_members')
- .delete()
- .eq('company_id', company.id)
-
- if (membersError) {
- console.error('❌ Error deleting members:', membersError)
- return
- }
- console.log('✓ Company members deleted')
-
- // Step 10: Finally delete the company
- console.log('Step 9: Deleting company...')
- const { error: deleteError } = await supabase
- .from('companies')
- .delete()
- .eq('id', company.id)
-
- if (deleteError) {
- console.error('❌ Error deleting company:', deleteError)
- return
- }
- console.log('✓ Company deleted')
-
- console.log('✅ Successfully deleted Vertex Digital Solutions!')
- console.log()
- console.log('All related data has been removed:')
- console.log('- Company record')
- console.log('- All events')
- console.log('- All hackathons')
- console.log('- All company members')
- console.log('- All analytics records')
- console.log('- All moderation logs')
- console.log('- All audit logs')
- console.log()
- console.log('='.repeat(80))
- console.log('You can now create a fresh company with clean data!')
- console.log('='.repeat(80))
-
- } catch (error) {
- console.error('❌ Unexpected error:', error)
- }
-}
-
-deleteTestCompany().catch(console.error)
diff --git a/hooks/useAnalyticsTracking.ts b/hooks/useAnalyticsTracking.ts
index 6dc6bbb9..67098aa0 100644
--- a/hooks/useAnalyticsTracking.ts
+++ b/hooks/useAnalyticsTracking.ts
@@ -4,7 +4,6 @@ interface UseAnalyticsTrackingOptions {
eventSlug?: string
hackathonId?: string
trackView?: boolean
- trackClick?: boolean
}
// Helper to get or create session ID
@@ -44,12 +43,10 @@ export function useAnalyticsTracking({
eventSlug,
hackathonId,
trackView = true,
- trackClick = false,
}: UseAnalyticsTrackingOptions) {
const viewTracked = useRef(false)
- const clickTracked = useRef(false)
- console.log('[Analytics Hook] Initialized with:', { eventSlug, hackathonId, trackView, trackClick })
+ console.log('[Analytics Hook] Initialized with:', { eventSlug, hackathonId, trackView })
// Track view on mount with session-based deduplication
useEffect(() => {
@@ -125,27 +122,4 @@ export function useAnalyticsTracking({
return () => clearTimeout(timer)
}, [eventSlug, hackathonId, trackView])
-
- // Function to track click
- const trackClickEvent = async () => {
- if (clickTracked.current) return
-
- try {
- if (eventSlug) {
- await fetch(`/api/events/${eventSlug}/track-click`, {
- method: 'POST',
- })
- clickTracked.current = true
- } else if (hackathonId) {
- await fetch(`/api/hackathons/${hackathonId}/track-click`, {
- method: 'POST',
- })
- clickTracked.current = true
- }
- } catch (error) {
- console.error('Error tracking click:', error)
- }
- }
-
- return { trackClick: trackClickEvent }
}
diff --git a/lib/services/analytics-service.ts b/lib/services/analytics-service.ts
index 0b8d6433..f212891c 100644
--- a/lib/services/analytics-service.ts
+++ b/lib/services/analytics-service.ts
@@ -58,37 +58,7 @@ export class AnalyticsService {
}
}
- /**
- * Track a click for an event (e.g., registration button)
- */
- static async trackEventClick(eventSlug: string): Promise {
- const supabase = await createClient()
-
- const { data: event, error: eventError } = await supabase
- .from('events')
- .select('id, company_id, clicks')
- .eq('slug', eventSlug)
- .single()
-
- if (eventError || !event) {
- throw new Error('Event not found')
- }
- // Increment click count
- await supabase
- .from('events')
- .update({ clicks: (event.clicks || 0) + 1 })
- .eq('id', event.id)
-
- // Update company analytics if event has a company
- if (event.company_id) {
- await this.incrementCompanyAnalytics(
- event.company_id,
- 'total_clicks',
- 1
- )
- }
- }
/**
* Track a registration for an event
@@ -174,37 +144,7 @@ export class AnalyticsService {
}
}
- /**
- * Track a click for a hackathon
- */
- static async trackHackathonClick(hackathonId: string): Promise {
- const supabase = await createClient()
-
- const { data: hackathon, error: hackathonError } = await supabase
- .from('hackathons')
- .select('id, company_id, clicks')
- .eq('id', hackathonId)
- .single()
-
- if (hackathonError || !hackathon) {
- throw new Error('Hackathon not found')
- }
- // Increment click count
- await supabase
- .from('hackathons')
- .update({ clicks: (hackathon.clicks || 0) + 1 })
- .eq('id', hackathon.id)
-
- // Update company analytics if hackathon has a company
- if (hackathon.company_id) {
- await this.incrementCompanyAnalytics(
- hackathon.company_id,
- 'total_clicks',
- 1
- )
- }
- }
/**
* Increment a specific field in company analytics
diff --git a/next.config.ts b/next.config.ts
index 40215fa4..8625f12f 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -85,6 +85,11 @@ const nextConfig: NextConfig = {
hostname: 'images.unsplash.com',
pathname: '/**',
},
+ {
+ protocol: 'https',
+ hostname: 'example.com',
+ pathname: '/**',
+ },
],
},