2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

vue.js google adsense

Posted at

vue.js で adsense を使いたい。

参考
https://www.ketancho.net/entry/2018/05/22/080000

インスコ


npm install vue-adsense --save

コード改変

これをやらないとエラーが出る

vim node_modules/vue-adsense/main.js をして、
以下の内容に変更

node_modules/vue-adsense/main.js

import VueAdsense from './VueAdsense.vue'
export default VueAdsense

app.js に追記

app.js

import VueAdsense from 'vue-adsense'
// Google Adsense 用
Vue.component('adsense', VueAdsense)

コード挿入

使いたいコードに以下を追記して完了。
それぞれ、adsenseから拾ったデータを入れること。

hoge.vue

<adsense
        ad-client="ca-pub-xxx"
        ad-slot="2061149xxxx"
        ad-format="auto"
        full-width-responsive="true">
</adsense>


2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?