johannschopplich / nuxt-gtag

🔸 Google Analytics & Ads integration made easy
https://developers.google.com/tag-platform/gtagjs
MIT License
302 stars 9 forks source link

Browser Console Error: Uncaught ReferenceError: defineNuxtPlugin is not defined #3

Closed modbender closed 1 year ago

modbender commented 1 year ago

Environment


Reproduction

export default defineNuxtConfig({
  modules: ['nuxt-gtag'],

  gtag: {
    id: 'G-XXXXXXXXXX'
  }
})

Describe the bug

GTag doesn't work. On browser console I see this error:

Uncaught ReferenceError: defineNuxtPlugin is not defined at plugin.client.mjs?v=54cefaf0:1:1

You should probably add this to plugin.client.ts

import { defineNuxtPlugin, useRuntimeConfig } from "#app";

Additional context

No response

Logs

No response

johannschopplich commented 1 year ago

Oh snap. 🙈 Thanks for reporting!

modbender commented 1 year ago

@johannschopplich also missing in composable: https://github.com/johannschopplich/nuxt-gtag/blob/main/src/runtime/composables/useGtag.ts

Uncaught (in promise) ReferenceError: useNuxtApp is not defined.

johannschopplich commented 1 year ago

That's the same problem. Somehow didn't happen during playground testing... Will fix it asap. Thanks for testing!

johannschopplich commented 1 year ago

Fixed in https://github.com/johannschopplich/nuxt-gtag/commit/e09a1e597d7ca2dfb42906bd4c7358fa64f92afb.

Please use v0.2.2 – should be deployed in a minute. 🙂