How do I integrate this with NuxtJS?
rlam3 opened this issue ยท 7 comments
How do I integrate this with NuxtJS?
Honestly, I never test for Nuxt and also didn't understand how plugin work in Nuxt.
Maybe need some research for me.
I will keep this issue open and will poke you if already supported.
Thanks @rlam3 ๐
I would also love support for Nuxt
I hope this can help: https://nuxtjs.org/guide/plugins#__nuxt
After reading that tutorial, I think we don't need to change any code here.
Just need clarify how to use this plugin.
From the article we can do like this, but still need tested :
Create file plugins/vue-google-adsense.js
, with code :
import Vue from 'vue'
import Ads from 'vue-google-adsense'
Vue.use(require('vue-script2'))
Vue.use(Ads.Adsense)
Vue.use(Ads.InArticleAdsense)
Vue.use(Ads.InFeedAdsense)
Then update your nuxt.config.js
, with code :
module.exports = {
plugins: [
{ src: '~/plugins/vue-google-adsense', ssr: false }
]
}
Thank you a lot for taking your time and investigating the issue!
It seems to be working now, thank you a lot. I'll report back if I encounter any problems.
P.S
I tried this exact approach without the ssr: false
option, my bad.