Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicated plausible props #2578

Merged
merged 4 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions frontend/src/composables/use-analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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()

Expand All @@ -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,
}
: {}),
}))

/**
Expand All @@ -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,
}
Expand All @@ -73,7 +57,7 @@ export const useAnalytics = () => {
props: {
...isomorphicProps.value,
...windowProps.value,
...payload, // can override mandatory props
...payload,
},
})
}
Expand Down
16 changes: 1 addition & 15 deletions packages/eslint-plugin/src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
},
],
},
Expand Down