Coder Social home page Coder Social logo

vue-dfp's Introduction

Vue DoubleClick for Publishers

Installation

npm install vue-doubleclick

Then require the plugin in you js file:

import DoubleClick from 'vue-doubleclick';

Vue.use(DoubleClick, {
    id: '{your-dfp-id}'
});

Afterwards you can you BannerAd component:

<google-ad unit="{Ad Unit Name}"></google-ad>

Component generates random container id, however you can pass your own value

<google-ad unit="{Ad Unit Name}" id="my-container-id"></google-ad>

Mappings

Plugin allows you to define custom mappings (forcing ad size on different screens):

let mappings = {
    rectangle: [
        { window: [0, 0], sizes: [[300, 250], [300, 300],[300, 100],[250, 250]] },
        { window: [1050, 350], sizes: [[250, 250], [300, 250], [300, 100], [300, 600], [240, 400], [160, 600], [120,600]] },
    ],
    banner: [
        { window: [0, 0], sizes: [[300, 250], [300, 300],[300, 100],[250, 250]] },
        { window: [750, 200], sizes: [[750, 300], [750, 200], [300, 300], [300,250], [750, 100], [728, 90], [600,200]] },
        { window: [1050, 350], sizes: [[1200, 400], [970, 90], [750, 300], [750, 200], [750, 100], [728, 90], [600,200], [900,300], [970, 250], [970, 415]] },
        { window: [1200, 350], sizes: [[1200, 600], [1200, 400]] },
    ]
};

and then pass it as another option at install:

Vue.use(DoubleClick, {
    id: '{your-dfp-id}',
    mappings
});

Ad Unit Sizes

You should define your own Ad Unit Sizes, however this plugin is delivered with 2 base sizes:

let sizes = {
    banner: [[1200, 600], [1200, 400], [300, 250], [300, 300]],
    rectangle: [ [300, 250], [300, 300], [300, 600]]
};

If you define your own sizes, pass them just like mappings

Vue.use(DoubleClick, {
    id: '{your-dfp-id}',
    sizes
});

Contributing

Any and all contributions will be greatly appreciated.

vue-dfp's People

Contributors

sesze avatar curly33 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.