Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Disable GSC & Keywords for Swetrix CE

Blue Mousefd9d16d7ecdc
diff --git a/web/app/pages/Project/Settings/ProjectSettings.tsx b/web/app/pages/Project/Settings/ProjectSettings.tsx
index e6c3a73c6..b42b3f7b5 100644
--- a/web/app/pages/Project/Settings/ProjectSettings.tsx
+++ b/web/app/pages/Project/Settings/ProjectSettings.tsx
@@ -315,11 +315,35 @@ const ProjectSettings = () => {
type SettingsTab = 'general' | 'shields' | 'access' | 'integrations' | 'emails' | 'people' | 'danger'
+ const tabs = useMemo(
+ () =>
+ [
+ { id: 'general', label: t('project.settings.tabs.general'), icon: Settings2Icon, visible: true },
+ { id: 'access', label: t('project.settings.tabs.access'), icon: LockIcon, visible: true },
+ { id: 'shields', label: t('project.settings.tabs.shields'), icon: ShieldIcon, visible: true },
+ {
+ id: 'integrations',
+ label: t('project.settings.tabs.integrations'),
+ icon: PuzzleIcon,
+ visible: !isSelfhosted,
+ },
+ { id: 'emails', label: t('project.settings.tabs.emails'), icon: MailIcon, visible: !isSelfhosted },
+ { id: 'people', label: t('project.settings.tabs.people'), icon: UserRoundIcon, visible: true },
+ {
+ id: 'danger',
+ label: t('project.settings.tabs.danger'),
+ icon: TriangleAlertIcon,
+ visible: project?.role === 'owner',
+ },
+ ].filter((tab) => tab.visible),
+ [t, project?.role],
+ )
+
const activeTab = useMemo<SettingsTab>(() => {
const tab = searchParams.get('tab') as SettingsTab
- const allowed = new Set<SettingsTab>(['general', 'shields', 'access', 'integrations', 'emails', 'people', 'danger'])
+ const allowed = new Set(tabs.map((t) => t.id as SettingsTab))
return allowed.has(tab) ? tab : 'general'
- }, [searchParams])
+ }, [searchParams, tabs])
const setActiveTab = (tab: SettingsTab) => {
const newSearchParams = new URLSearchParams(searchParams.toString())
@@ -621,25 +645,6 @@ const ProjectSettings = () => {
document.title = `${t('project.settings.settings')} ${form.name} ${TITLE_SUFFIX}`
}, [form, t])
- const tabs = useMemo(
- () =>
- [
- { id: 'general', label: t('project.settings.tabs.general'), icon: Settings2Icon, visible: true },
- { id: 'access', label: t('project.settings.tabs.access'), icon: LockIcon, visible: true },
- { id: 'shields', label: t('project.settings.tabs.shields'), icon: ShieldIcon, visible: true },
- { id: 'integrations', label: t('project.settings.tabs.integrations'), icon: PuzzleIcon, visible: true },
- { id: 'emails', label: t('project.settings.tabs.emails'), icon: MailIcon, visible: !isSelfhosted },
- { id: 'people', label: t('project.settings.tabs.people'), icon: UserRoundIcon, visible: true },
- {
- id: 'danger',
- label: t('project.settings.tabs.danger'),
- icon: TriangleAlertIcon,
- visible: project?.role === 'owner',
- },
- ].filter((tab) => tab.visible),
- [t, project?.role],
- )
-
const currentTabLabel = useMemo(() => {
return (tabs.find((t) => t.id === activeTab)?.label as string) || ''
}, [tabs, activeTab])
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index aca7f3ff1..ede8873ba 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -3931,7 +3931,7 @@ const ViewProjectContent = () => {
if (type === 'traffic-sources') {
const trafficSourcesTabs = [
{ id: 'ref', label: t('project.mapping.ref') },
- { id: 'keywords', label: t('project.mapping.keywords') },
+ !isSelfhosted && { id: 'keywords', label: t('project.mapping.keywords') },
[
{ id: 'so', label: t('project.mapping.so') },
{ id: 'me', label: t('project.mapping.me') },
@@ -3939,7 +3939,7 @@ const ViewProjectContent = () => {
{ id: 'te', label: t('project.mapping.te') },
{ id: 'co', label: t('project.mapping.co') },
],
- ]
+ ].filter((x) => !!x)
const getTrafficSourcesRowMapper = (activeTab: string) => {
if (activeTab === 'ref') {