damevin / nuxt-module-hotjar

Add Hotjar to your Nuxt application
MIT License
4 stars 1 forks source link

useHotjar composable is not working #19

Closed tamanna-makkar closed 1 month ago

tamanna-makkar commented 2 months ago

I need to use the initialize() when I have cookies enabled

I simply tried to added like this const { initialize } = useHotjar()

am getting ref not defined error

image

damevin commented 2 months ago

Hey !

Thanks for your report, could you provide me a reproduction ? How do you use the function initialize in your code ?

matheusm commented 1 month ago

Hi @damevin ,

I'm experiencing the same issue. In my code, I'm unable to use useHotjar() anywhere. No matter where I place it, I encounter this error. I've followed the recommended configurations, but I still keep getting the error.

My nuxt version: "nuxt": "^3.11.2",

Here is my package.json
{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@nuxt/image": "^1.7.0",
    "@nuxtjs/critters": "^0.7.1",
    "@nuxtjs/robots": "^3.0.0",
    "@pinia/nuxt": "^0.5.1",
    "@sentry/browser": "^8.7.0",
    "@sentry/node": "^8.7.0",
    "@sentry/vite-plugin": "^2.18.0",
    "@sentry/vue": "^8.7.0",
    "@vee-validate/nuxt": "^4.12.6",
    "@zootools/email-spell-checker": "^1.12.0",
    "click-outside-vue3": "^4.0.1",
    "maska": "^2.1.11",
    "nuxt": "^3.11.2",
    "nuxt-gtag": "^2.0.6",
    "nuxt-lazy-hydrate": "^1.0.0",
    "nuxt-module-hotjar": "^1.3.0",
    "pinia": "^2.1.7",
    "qrcode": "^1.5.3",
    "uuid": "^9.0.1",
    "vue": "^3.4.21",
    "vue-recaptcha-v3": "^2.0.1",
    "vue-router": "^4.3.0",
    "vue-tel-input": "^9.1.4"
  },
  "devDependencies": {
    "@fortawesome/free-brands-svg-icons": "^6.5.2",
    "@fortawesome/free-regular-svg-icons": "^6.5.2",
    "@fortawesome/free-solid-svg-icons": "^6.5.2",
    "@nuxtjs/device": "^3.1.1",
    "@nuxtjs/google-fonts": "^3.2.0",
    "@nuxtjs/i18n": "^8.3.0",
    "@types/vue-tel-input": "^2.1.6",
    "@vesp/nuxt-fontawesome": "^1.0.4",
    "sass": "^1.74.1"
  }
}

Here is my configs is nuxt.config.js
  hotjar: {
    hotjarId: mycode,
    scriptVersion: 6,
    debug: true,
  },
damevin commented 1 month ago

@matheusm thanks for the reporting !

I've fixed the bug 😀

Just update the module to 1.3.1 : https://github.com/damevin/nuxt-module-hotjar/releases/tag/v1.3.1

Have a nice day 🙌