Giter VIP home page Giter VIP logo

vue-google-adsense's Introduction

๐Ÿ’ต Vue Google Adsense

Vue.js Google Adsense Component with InFeed and InArticle Ads support

License version downloads

๐Ÿš€ Skeleton generated with Vue-CLI using template vuejs-template-plugin

๐ŸŽ‰ Demo

https://mazipan.github.io/vue-google-adsense/

โ“ What is In Feed and In Article Ads?

At least there is three (3) type ads in Google Adsense :

  • Responsive Ads: A simple way to get ads on your page. Choose the size, placement and style you want to display. Learn more

  • In Article Ads: Ads that fit seamlessly in between the paragraphs of your pages for an enhanced reading experience. Learn more

  • In Feed Ads: Ads that flow naturally inside a list of articles or products on your site, offering a great user experience. Learn more

๐Ÿš€ Getting started

Installation

Need dependencies vue-script2, you need to install :

npm install vue-script2 vue-google-adsense --save

Use in main.js

import Ads from 'vue-google-adsense'

Vue.use(require('vue-script2'))

Vue.use(Ads.Adsense)
Vue.use(Ads.InArticleAdsense)
Vue.use(Ads.InFeedAdsense)

Usage in Nuxt.js

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

Template

VueAdsense Template :

<Adsense
    data-ad-client="ca-pub-XXXXXXXXXXXXXXXX"
    data-ad-slot="1234567890">
</Adsense>

VueInArticleAdsense Template :

<InArticleAdsense
    data-ad-client="ca-pub-XXXXXXXXXXXXXXXX"
    data-ad-slot="1234567890">
</InArticleAdsense>

VueInFeedAdsense Template :

<InFeedAdsense
    data-ad-layout-key="-fg+5n+6t-e7+r"
    data-ad-client="ca-pub-XXXXXXXXXXXXXXXX"
    data-ad-slot="1234567890">
</InFeedAdsense>

๐ŸŽ Available Props

Attribute Type Default Description
root-class String adswrapper Class for fill in wrapper block
data-ad-client String empty Attribute data-ad-client from adsense
data-ad-slot String empty Attribute data-ad-slot from adsense
data-ad-layout-key String empty Attribute data-ad-layout-key from adsense
data-ad-test String empty Attribute data-ad-test from adsense

๐Ÿค˜ Who is using this library

Already used in production for these project :

๐Ÿƒ Development

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production demo with minification
npm run build

# build for plugin distribution file
npm run pack

# run build and pack
npm run dist

For detailed explanation on how things work, consult the docs for vue-loader.

Contact Me :

Email Facebook Twitter

Copyright ยฉ 2018 Built with โค๏ธ by Irfan Maulana

vue-google-adsense's People

Contributors

mazipan avatar pollitosabroson avatar

Watchers

James Cloos avatar Muhammad Abdurrahman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.