Laravel - Vue app : comply with european cookies law? - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, May 27, 2023

Laravel - Vue app : comply with european cookies law?

I'm working on a laravel-vue app which is going to launch in the United States but european users might visit my webpage, so I have to comply with Cookies europen laws.

My laravel app uses laravel standard cookies set, I Don't not use google analytics or similar.

What am I'm planning to do:

I plan to show the cookie modal with Accept and Decline options, if the user has not accepted cookies I unset all cookies from browser with my unsetAllCookies method, on each page Load, is that enough to not get sued?

Do you know of any npm/composer package that makes this easy to handle?

My functions are the following:

onDeclinedCookies()
    {
        this.setCookiesAccepted(true);
        this.unsetAllCookies();
    },

    onAcceptedCookies()
    {
        this.setCookiesAccepted(true);
    },

    unsetAllCookies()
    {
        // retrieve all cookies
        var Cookies = document.cookie.split(';');
        // set past expiry to all cookies
        for (var i = 0; i < Cookies.length; i++)
        {
            document.cookie = Cookies[i] + "=; expires="+ new Date(0).toUTCString();
        }
    }


source https://stackoverflow.com/questions/76343305/laravel-vue-app-comply-with-european-cookies-law

No comments:

Post a Comment