Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

ambitiondev/vue-cookiebot-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vue Cookiebot Plugin

version version

This vue plugin allows you to (dynamically) set up your Cookiebot implementation and load the consent banner and consent page on demand

Installation

  1. Install module: npm i @ambitiondev/vue-cookiebot-plugin --save or yarn add @ambitiondev/vue-cookiebot-plugin
  2. Go to the main JS-file of your Vue app and add the following:
  import Vue from 'vue'
  ...
  import VueCookieBot from '@ambitiondev/vue-cookiebot-plugin'

  Vue.use(VueCookieBot, {
    cookieBotID: 'insert your cookiebot ID here'
  })

  const app = new Vue({
    ...
  })
  1. The variable $cookiebot has been added to the Vue instance. You can trigger the consent banner where you'd like by executing:
  <script>
    export default {
      name: 'MyVueComponent',
      mounted () {
        this.$cookiebot.consentBanner()
      }
    }
  </script>

Documentation / API reference

For the full API reference regarding the Vue Plugin install method, see the Vue plugin install docs

For a list of available methods and properties on the $cookiebot instance, see the Vue plugin methods docs