import React from 'react' import { Head } from '@inertiajs/react' import AdminLayout from '../../../Layouts/AdminLayout' import AnalyticsNav from './AnalyticsNav' function SearchList({ title, items = [], emptyText }) { return (

{title}

{items.length ? items.map((item, index) => (

{item.query}

{'searches' in item ?

{item.searches}

: null}
{'avg_results' in item ?

Average results: {item.avg_results}

: null} {'clicks' in item ?

Clicks: {item.clicks}

: null} {'click_through_rate' in item ?

CTR: {item.click_through_rate}%

: null} {'results_count' in item ?

Results: {item.results_count}

: null}
)) :

{emptyText}

}
) } function FilterUsageList({ items = [] }) { return (

Filter Usage

{items.length ? items.map((item) => (

{item.filter}: {item.value}

{item.uses}

)) :

No Academy search filters were used in this range.

}
) } function ClickedResultsList({ items = [] }) { return (

Top Clicked Results

{items.length ? items.map((item) => (

{item.title}

{item.clicks}

{item.content_type}

)) :

No clicked Academy search results were logged in this range.

}
) } export default function AcademyAnalyticsSearch({ nav = [], range, summary = {}, topSearches = [], zeroResults = [], lowClickThroughSearches = [], highestClickThroughSearches = [], searchesWithResultsNoClicks = [], topClickedResults = [], filterUsage = [], recentSearches = [] }) { return (

Searches

{Number(summary.searches || 0).toLocaleString()}

Zero Result Searches

{Number(summary.zeroResultSearches || 0).toLocaleString()}

Logged-in Searches

{Number(summary.loggedInSearches || 0).toLocaleString()}

Subscriber Searches

{Number(summary.subscriberSearches || 0).toLocaleString()}

Searches With Clicks

{Number(summary.searchesWithClicks || 0).toLocaleString()}

Needs CTR Tracking

Low-click sections use stored search click attribution when present. Queries without clicked-result updates will stay at 0% CTR until that interaction is sent.

Range

{range?.from} to {range?.to}

) }