Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Remove duplicated plausible props (#2578)

Zack Krida53c2e70171e2
diff --git a/frontend/src/composables/use-analytics.ts b/frontend/src/composables/use-analytics.ts
index 8640340a3..69db7afe7 100644
--- a/frontend/src/composables/use-analytics.ts
+++ b/frontend/src/composables/use-analytics.ts
@@ -4,7 +4,6 @@ import { useContext } from "@nuxtjs/composition-api"
import type { Events, EventName } from "~/types/analytics"
import { useUiStore } from "~/stores/ui"
import { useFeatureFlagStore } from "~/stores/feature-flag"
-import { useI18n } from "~/composables/use-i18n"
import { log } from "~/utils/console"
@@ -13,8 +12,7 @@ import { log } from "~/utils/console"
* bounds of the composition API.
*/
export const useAnalytics = () => {
- const { $plausible, $ua } = useContext()
- const i18n = useI18n()
+ const { $plausible } = useContext()
const uiStore = useUiStore()
const featureFlagStore = useFeatureFlagStore()
@@ -27,18 +25,7 @@ export const useAnalytics = () => {
* client-side; This excludes props that need `window`.
*/
const isomorphicProps = computed(() => ({
- timestamp: new Date().toISOString(),
- language: i18n.locale,
breakpoint: uiStore.breakpoint,
- ...($ua
- ? {
- ua: $ua.source,
- os: $ua.os,
- platform: $ua.platform,
- browser: $ua.browser,
- version: $ua.version,
- }
- : {}),
}))
/**
@@ -48,9 +35,6 @@ export const useAnalytics = () => {
const windowProps = computed(() =>
window
? {
- origin: window.location.origin,
- pathname: window.location.pathname,
- referrer: window.document.referrer,
width: window.innerWidth,
height: window.innerHeight,
}
@@ -73,7 +57,7 @@ export const useAnalytics = () => {
props: {
...isomorphicProps.value,
...windowProps.value,
- ...payload, // can override mandatory props
+ ...payload,
},
})
}
diff --git a/packages/eslint-plugin/src/configs/recommended.ts b/packages/eslint-plugin/src/configs/recommended.ts
index 3e0fd959a..cd76b3f51 100644
--- a/packages/eslint-plugin/src/configs/recommended.ts
+++ b/packages/eslint-plugin/src/configs/recommended.ts
@@ -3,21 +3,7 @@ export const recommended = {
"@openverse/analytics-configuration": [
"error",
{
- reservedPropNames: [
- "timestamp",
- "language",
- "breakpoint",
- "ua",
- "os",
- "platform",
- "browser",
- "version",
- "origin",
- "pathname",
- "referrer",
- "width",
- "height",
- ],
+ reservedPropNames: ["width", "height"],
},
],
},