updated CookieConsentBtn.vue
This commit is contained in:
@@ -47,40 +47,41 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useCookies } from "vue3-cookies";
|
||||
|
||||
export default {
|
||||
name: "CookieConsentBtn",
|
||||
setup() {
|
||||
const tracking = ref(true);
|
||||
const { cookies } = useCookies();
|
||||
const consent = ref(false);
|
||||
const tracking = ref(true);
|
||||
const { cookies } = useCookies();
|
||||
const consent = ref(false);
|
||||
|
||||
const handleConsent = () => {
|
||||
window._paq.push(["rememberCookieConsentGiven"]);
|
||||
cookies.set("consent", "given", Infinity);
|
||||
const handleConsent = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
window._paq.push(["rememberCookieConsentGiven"]);
|
||||
cookies.set("consent", "given", Infinity);
|
||||
|
||||
if (tracking.value) {
|
||||
window._paq.push(["rememberConsentGiven"]);
|
||||
}
|
||||
consent.value = true;
|
||||
};
|
||||
const handleConsentForget = () => {
|
||||
consent.value = true;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
window._paq.push(["requireCookieConsent"]);
|
||||
window._paq.push(["trackPageView"]);
|
||||
|
||||
if (cookies.get("consent") === "given") consent.value = true;
|
||||
});
|
||||
|
||||
return { handleConsent, handleConsentForget, tracking, consent };
|
||||
},
|
||||
if (tracking.value) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
window._paq.push(["rememberConsentGiven"]);
|
||||
}
|
||||
consent.value = true;
|
||||
};
|
||||
const handleConsentForget = () => {
|
||||
consent.value = true;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
window._paq.push(["requireCookieConsent"]);
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
window._paq.push(["trackPageView"]);
|
||||
|
||||
if (cookies.get("consent") === "given") consent.value = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
Reference in New Issue
Block a user