
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
klaro-gridsome
Advanced tools
Wrapper for Klaro! cookie consent manager for easy use in Gridsome projects
Wrapper for Klaro! cookie consent manager for easy use in Gridsome projects.
npm install klaro-gridsome
Include in plugins
in gridsome.config.js
module.exports = {
plugins: [
{
use: 'klaro-gridsome',
options: {
// your klaro configuration here
}
}
]
}
Populates klaroConfig and accepts the same configuration. See klaro's config.js for a sample configuration.
module.exports = {
plugins: [
{
use: 'klaro-gridsome',
options: {
privacyPolicy: '/privacy-policy/',
cookieName: 'consent',
translations: {
en: {
consentModal: {
description: 'Here you can see and customize the information that we collect about you.',
},
googleAnalytics: {
description: 'Website analytics powered by Google Analytics, allowing us to see how visitors use our website.'
},
purposes: {
analytics: 'Analytics'
},
},
},
apps: [
{
name: 'googleAnalytics',
default: true,
title: 'Google Analytics',
purposes: ['analytics'],
cookies: [
'_ga',
'_gcl_au',
'_gid',
'_gat'
],
required: false,
optOut: true,
onlyOnce: false
}
]
}
}
]
}
Klaro normally handles opting in/out of tracking by relying upon new page loads and by replacing the type of script elements. With a framework like Vue, this has to be handled manually.
Whenever consent is changed the consentUpdate
event is fired on the document with the update. You can use this to listen to a change and respond accordingly. The event.detail
object will include the app name changed, and a boolean consent property showing the current opt-in/opt-out value.
export default {
mounted() {
document.addEventListener('consentUpdate', this.consentToggle)
},
beforeDestroy() {
document.removeEventListener('consentUpdate', this.consentToggle)
},
methods: {
consentToggle(event) {
// only is app is google analytics
if (event.detail.app === 'googleAnalytics') {
if (event.detail.consent) {
// if user consent is true
this.$ga.enable()
} else {
// if user consent is false
this.$ga.disable()
}
}
}
}
}
As the consentUpdate
event is only fired on a change, you will need to make sure you check Klaro consent before enabling any tracking. This can be done with window.klaro.getManager().consents
, which includes the current state of all consents.
Vue.use(VueAnalytics, {
disabled: () => {
return !window.klaro.getManager().consents.googleAnalytics
}
})
Klaro copyright and License in klaro/LICENSE.
Copyright © 2020 Alistair Shepherd. Licensed under the MPL-2.0 License.
FAQs
Wrapper for Klaro! cookie consent manager for easy use in Gridsome projects
The npm package klaro-gridsome receives a total of 115 weekly downloads. As such, klaro-gridsome popularity was classified as not popular.
We found that klaro-gridsome demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.