Skip to content

Commit

Permalink
Include breakpoint in custom event props
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb committed Mar 15, 2023
1 parent d2be96c commit 3466fe7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frontend/src/composables/use-analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { computed } from "vue"
import { useContext } from "@nuxtjs/composition-api"

import type { Events, EventName } from "~/types/analytics"
import { useUiStore } from "~/stores/ui"

/**
* The `ctx` parameter must be supplied if using this composable outside the
* bounds of the composition API.
*/
export const useAnalytics = () => {
const { $plausible, $ua, i18n } = useContext()
const uiStore = useUiStore()

/**
* the Plausible props that work identically on the server-side and the
Expand All @@ -17,6 +19,7 @@ export const useAnalytics = () => {
const isomorphicProps = computed(() => ({
timestamp: new Date().toISOString(),
language: i18n.locale,
breakpoint: uiStore.breakpoint,
...($ua
? {
ua: $ua.source,
Expand Down

0 comments on commit 3466fe7

Please sign in to comment.