You've already forked AstralRinth
forked from didirus/AstralRinth
Change ads provider, and add consent system for advertising (#155)
* Add GAM integration & base for GPDR consent * Moved consent to a specific page. * Added functionality to the privacy page, and desactivate tracking if consent is not given. * Added GeoEdge support, and fixed auth issues * Fix actions issue * Fix actions issue, attempt 2 * Added a module for analytics with consent support. * Remove unnecessary function * Add support for runtime config
This commit is contained in:
35
components/ads/Advertisement.vue
Normal file
35
components/ads/Advertisement.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="ad-wrapper">
|
||||
<div class="ad">
|
||||
<GptAd :ad-unit="adUnit" :size="size" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/* eslint-disable no-undef */
|
||||
export default {
|
||||
name: 'Advertisement',
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
adUnit: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ad-wrapper {
|
||||
width: 100%;
|
||||
@extend %card;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-bottom: var(--spacing-card-md);
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
77
components/ads/CookieConsent.vue
Normal file
77
components/ads/CookieConsent.vue
Normal file
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<div>
|
||||
<ReviewPopup ref="popup" />
|
||||
<div
|
||||
ref="container"
|
||||
class="container"
|
||||
:style="{ visibility: shown ? 'visible' : 'hidden' }"
|
||||
>
|
||||
<div class="banner">
|
||||
<span>
|
||||
Modrinth uses cookies for various purposes, including advertising.<br />
|
||||
We encourage you to review your privacy settings by clicking on the
|
||||
button below:
|
||||
</span>
|
||||
<div class="actions">
|
||||
<button class="btn button" @click="hide">Accept all</button>
|
||||
<button class="btn brand-button" @click="review">Review</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CookieConsent',
|
||||
data() {
|
||||
return {
|
||||
shown: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// Get informations in the store
|
||||
this.$store.dispatch('consent/loadFromCookies', this.$cookies)
|
||||
if (
|
||||
!this.$store.state.consent.is_consent_given &&
|
||||
this.$route.path !== '/dashboard/privacy'
|
||||
) {
|
||||
this.shown = true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
hide() {
|
||||
this.shown = false
|
||||
},
|
||||
review() {
|
||||
this.hide()
|
||||
this.$router.push('/dashboard/privacy')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
z-index: 20;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
.banner {
|
||||
@extend %card;
|
||||
margin: 0 2rem 2rem 0;
|
||||
padding: 1rem;
|
||||
max-width: 18vw;
|
||||
border-left: solid 5px var(--color-brand);
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-top: 1rem;
|
||||
.btn {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
24
components/ads/ReviewPopup.vue
Normal file
24
components/ads/ReviewPopup.vue
Normal file
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<Popup :show-popup="shown"> </Popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ReviewPopup',
|
||||
data() {
|
||||
return {
|
||||
shown: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.shown = true
|
||||
},
|
||||
hide() {
|
||||
this.shown = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
Reference in New Issue
Block a user