nuxt-community / google-optimize-module

SSR friendly Google Optimize module for Nuxt.js
MIT License
215 stars 32 forks source link

use injected `$ga` instead of `window.ga` #49

Open AliRezaBeitari opened 3 years ago

AliRezaBeitari commented 3 years ago

Use the injected ctx.$ga handler from @nuxtjs/google-analytics instead of window.ga package if it is available.

I myself had some difficulties with the new version of @nuxtjs/google-analytics package which window.ga was not available in the googleOptimize function; but after using the injected $ga handler, it was working fine.