GithubHelp home page GithubHelp logo

storipress / vue-advertising Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 2.0 5.09 MB

Simplify programmatic ad-ops in Vue applications.

Home Page: https://storipress.com/features/engage-monetise#programmatic

TypeScript 21.68% JavaScript 49.46% Vue 28.86%
ads advertising library vue adops dfp doubleclick doubleclick-for-publishers gpt mit-license

vue-advertising's Introduction

vue-advertising

Vue Advertising
A JavaScript library for display ads in Vue applications.

Introduction

Integrate ads in your app the “Vue way". A set of helpers for integrating complex advertising setups in Vue projects. It reduces the pain of integrating advertising in server side rendered projects. It also takes care of bloat by centralising configuration.

Why

We believe content is core to any modern society. However, it is getting more and more difficult to monetise content with advertising whilst using modern development tools. Advertising needs a revamp. A renovation. Modernised for the way we create content today.

  • One central configuration file for all your Google Publisher Tags and Prebid placements (Prebid is optional)
  • One provider component that handles all the “plumbing” with googletag and pbjs, nicely hidden away
  • Ad slot components that get filled with creatives from the ad server when they mount to the DOM
  • Works well in single page applications with multiple routes
  • Suitable for server-side-rendering
  • Supports lazy loading, even for Prebid ads, individually configurable per ad slot

Prerequisites

Google Ad Manager

You will need a Google Ad Manager account set up to deliver display ads through Google Publisher Tags (GPT).

Optionally, vue-advertising real-time header bidding with Prebid.

Dependencies

vue-advertising requires @vueuse/head or @unhead/vue to manage and load scripts. Please make sure you are using Karbon or Nuxt, or have set up @vueuse/head or @unhead/vue in your project.

Documentation

You can find more info in react-advertising (the original library which we ported to Vue)

Below is the basic usage of vue-advertising

Set up your ad providers

  1. Create your GPT config
const gptConfig = {
  slots: [
    {
      id: 'banner-ad',
      path: '/6355419/Travel/Europe/France/Paris',
      sizes: [[300, 250]],
    },
  ],
  usePrebid: false,
  useAPS: false,
  customEvents: {
    blueBackground: {
      eventMessagePrefix: 'BlueBackground:',
    },
  },
}
  1. In places you want to show advertising, wrap the area with AdvertisingProvider and provide the config from the previous step, so information in your config is passed to the ad slot.
<template>
  <AdvertisingProvider :config="gptConfig">
			...
  </AdvertisingProvider>
</template>
  1. Use AdvertisingSlot to display ads in the location where you want to show ads, and note that AdvertisingSlot must be used within AdvertisingProvider

    <AdvertisingSlot id="banner-ad" :is-sticky="true" />
  2. Your ads will now appear!

Preload ads (optional)

vue-advertising only

Replacing AdvertisingProvider with GlobalAdvertisingProvider and AdvertisingSlot with GlobalAdvertisingSlot can speed up the loading of ads.

Credits

  • @KijijiCA - original react-advertising
  • @ches4117 - rewrite react-advertising to vue-advertising

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.