A simple Vue component for handling Google Ads
npm install --save-dev vue-adsense
and include the adsbygoogle.js
file in your HTML
<script async src="https://github.com/darrynten/vue-adsense/raw/master//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Import the component
import VueAdsense from 'vue-adsense'
Register the component
Vue.component('adsense', VueAdsense)
And put into your DOM
<adsense
ad-client="ca-pub-xxxxxxxxxxxxxxxx"
ad-slot="XXXXXXXX"
ad-style="display: block"
ad-format="auto">
</adsense>
Contributions welcome, enjoy the component