Search insights: what is recorded and for how long. The insights are on Insights. */ final class InsightsScreen { public static function render(): string { $on = !empty(Settings::get('insights_enabled')); $body = $on ? Ui::actions([['label' => __('See the insights', 'aipcf-ai-provider-for-cloudflare'), 'url' => InsightsTab::pageUrl()]]) : ''; $body .= Ui::row(__('Search insights', 'aipcf-ai-provider-for-cloudflare'), Ui::toggle('insights_enabled', $on, __('Record the searches made on the site', 'aipcf-ai-provider-for-cloudflare'), 'aipcf-insights-enabled'), [ 'for' => 'aipcf-insights-enabled', 'help' => __('No user, IP address or browser details are kept. Known bots are skipped.', 'aipcf-ai-provider-for-cloudflare'), ]); $body .= Ui::row(__('A gap is', 'aipcf-ai-provider-for-cloudflare'), Ui::number('insights_gap_threshold', (float) Settings::get('insights_gap_threshold'), 'aipcf-insights-gap-threshold', ['min' => 0, 'max' => 1, 'step' => 0.05]), [ 'for' => 'aipcf-insights-gap-threshold', 'help' => __('A search whose best match is under this. 0.5 means a 50% match.', 'aipcf-ai-provider-for-cloudflare'), ]); $body .= Ui::row(__('Daily limit', 'aipcf-ai-provider-for-cloudflare'), Ui::number('insights_daily_neurons', (int) Settings::get('insights_daily_neurons'), 'aipcf-insights-daily-neurons', ['min' => 1, 'max' => 10000000, 'unit' => __('neurons a day', 'aipcf-ai-provider-for-cloudflare')]), [ 'for' => 'aipcf-insights-daily-neurons', 'help' => __('About 0.03 neurons per search compared, plus "What to write next".', 'aipcf-ai-provider-for-cloudflare'), ]); $body .= Ui::moreSettings( Ui::row(__('Keep searches for', 'aipcf-ai-provider-for-cloudflare'), Ui::number('insights_retention_days', (int) Settings::get('insights_retention_days'), 'aipcf-insights-retention-days', ['min' => 7, 'max' => 730, 'unit' => __('days', 'aipcf-ai-provider-for-cloudflare')]), [ 'for' => 'aipcf-insights-retention-days', 'help' => __('Older searches are deleted, also after this is switched off.', 'aipcf-ai-provider-for-cloudflare'), ]) . Ui::row(__('Searches recorded', 'aipcf-ai-provider-for-cloudflare'), Ui::number('insights_daily_rows', (int) Settings::get('insights_daily_rows'), 'aipcf-insights-daily-rows', ['min' => 100, 'max' => 100000, 'unit' => __('a day', 'aipcf-ai-provider-for-cloudflare')]), [ 'for' => 'aipcf-insights-daily-rows', 'help' => __('So a flood of searches cannot fill the database.', 'aipcf-ai-provider-for-cloudflare'), ]) ); return Ui::card(__('Search insights', 'aipcf-ai-provider-for-cloudflare'), $body, [ 'text' => __('What people search for on the site, and which searches your posts do not answer yet.', 'aipcf-ai-provider-for-cloudflare'), ]); } }