mazipan/vue-google-adsense

How do I integrate this with NuxtJS?

rlam3 opened this issue ยท 7 comments

rlam3 commented

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

Is there any link or sample project to create Plugin in Nuxt @AlexLomm ?

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 }
  ]
}

Hope this help you @AlexLomm @rlam3

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.

Okay @AlexLomm, I will put this issue to main docs in README.md.
So, people that have same problem can be solved with same approach.

Dont forget to give star โญ๏ธ in this repo ya.
Very appreciate that thing.