Code Monkey home page Code Monkey logo

laravel-cookie-consent's People

Contributors

axonc avatar birkaaa avatar cnimmo16 avatar florencerandaxhe avatar jornatf avatar petarkresimirculina avatar piotrknapik avatar rickyjohnston avatar sergey-fritzler avatar toonvandenbos avatar ubpon avatar voidgraphics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

laravel-cookie-consent's Issues

Translations not working

I have just duplicated the folder the de folder and renamed it to sv for Swedish. I have translated the strings
` <?php
return [
'title' => 'Vi använder cookies',
'intro' => 'Denna webbplats använder cookies för att förbättra den övergripande användarupplevelsen.',
'link' => 'Ta en titt på vår Cookies-policy för mer information.',

'essentials' => 'Endast det väsentliga',
'all' => 'Acceptera alla',
'customize' => 'Anpassa',
'manage' => 'Hantera cookies',
'details' => [
    'more' => 'Mer detaljer',
    'less' => 'Mindre detaljer',
],
'save' => 'Spara inställningar',

'categories' => [
    'essentials' => [
        'title' => 'Väsentliga cookies',
        'description' => 'Det finns vissa cookies som vi måste inkludera för att vissa webbsidor ska fungera. Därför kräver de inte ditt samtycke.',
    ],
    'analytics' => [
        'title' => 'Analyscookies',
        'description' => 'Vi använder dessa för intern forskning om hur vi kan förbättra den tjänst vi tillhandahåller för alla våra användare. Dessa cookies bedömer hur du interagerar med vår webbplats.',
    ],
    'optional' => [
        'title' => 'Valfria cookies',
        'description' => 'Dessa cookies aktiverar funktioner som kan förbättra din användarupplevelse, men deras frånvaro kommer inte påverka din förmåga att surfa på vår webbplats.',
    ],
],

'defaults' => [
    'consent' => 'Används för att lagra användarens cookie-samtyckesinställningar.',
    'session' => 'Används för att identifiera användarens webbläsarsession.',
    'csrf' => 'Används för att säkra både användaren och vår webbplats mot CSRF-attacker (cross-site request forgery).',
    '_ga' => 'Huvudcookie använd av Google Analytics, möjliggör en tjänst för att särskilja en besökare från en annan.',
    '_ga_ID' => 'Används av Google Analytics för att behålla sessionstillståndet.',
    '_gid' => 'Används av Google Analytics för att identifiera användaren.',
    '_gat' => 'Används av Google Analytics för att reglera förfrågningstakten.',
],
    ];
     `

but it doesn't work, I get cookieConsent::cookies.title instead of Vi använder cookies. I need help solving this as quickly as possible as my project is due to launch this week.

@cookieconsentview is present in the dom, but cannot display it (Ghostery extension problem)

Hello,

I followed the discussion #36 and saw that v1.2.1 was released following this problem.

I followed the readme to add the module correctly, I checked in the DOM if @cookieconsentview embed the dom, it does, but unable to display it unless I remove all css and id classes. So, I'm trying to find out what I missed or did wrong?? Thanks for your help

Stack :
Laravel 9 (I use laravel-boilerplate as project base)
Bootstrap 5.3.3
VueJs 2.5.17

My app.blade.php file
image

Example of the dom
image

Cannot accept consent when tunneling traffic through Ngrok

I'm currently having an issue with this library in a Laravel 10 application.

The issue is that on both Android and iOS accepting the cookie consent when my local development traffic is tunneled through Ngrok doesn't do anything, the consent box will not disappear.

I Might be missing something basic but i have updated to the latest version of the library 1.1.0. I have tried changing the APP_URL in my .env file to the Ngrok domain i'm given and I've also tried updating the domain in the cookieconsent.php file, nothing yet has fixed this.

The consent pop-up displays and closes as expected on my Windows and Linux desktop browsers when traffic is tunneled through Ngrok but the cookie is not set.

Steps to reproduce:

  • Install any version of this library
  • Tunnel traffic through Ngrok
  • Open the application on a mobile phone web browser
  • Press the "Accept all" or "Only essentials" buttons

Any help or suggestions are much appreciated.

Make @cookieconsentbutton more customizable

Yet it is possible to customize the button only to some extent.
I need to add tooltips and symbol instead of button text.

E.g.

@cookieconsentbutton(action: 'reset', label: '<i class="material-icons" style="font-size: 2em">shield</i>',
  attributes: ['id' => 'reset-button', 'class' => 'btn fixed-bottom cookie-reset'],
  btnattributes: ['class' => 'btn bg-transparent', 'style' => 'margin-left: 5px; margin-bottom:5px',
    'data-toggle' => 'tooltip', 'title' => __('cookieConsent::cookies.manage')])

I added a pull request #42 for that.
Hope it finds a way to the main code. @toonvandenbos fell free to check and adapt, as you have better insight into the code.
Thanks for your work and support!

Sentry TypeError

We're seeing issues in Sentry relating to the cookie consent.

TypeError
undefined is not an object (evaluating 'window.LaravelCookieConsent.acceptAll')

It's highlighting the following code as the issue.

<script data-cookie-consent>
{snip}  function(e){e.preventDefault(),window.LaravelCookieConsent.acceptAll(),l()}(e)})),r.addEventListener("submit",(function(e){return function( {snip}
</script>

Cookie Dialog Shows Up Again On Different Pages

Hi, I'm using Laravel 10+ and Inertia (React) SSR. The cookie consent dialog always shows up again on different pages other than the index route. After I navigate to the home page, that's when the dialog never shows up again on different pages on the site. Am I missing some configs? Thanks

Policy Page

Hello! I am a noob, so please don't blame me for the question:
How do I get my Policy Page (//mydomain/p/cookies-policy) in this:

'policy' => null,

I tried a lot like but have no idea what to do …
Adding an array I guess, but still no idea how to fill that.

@cookieconsentview is not rendered

Hi, I used the readme to integrate this cookie consent using laravel 10 (latest),
however, the app.blade.php
results in just printing @cookieconsentview instead of integrating it.

The package is included in vendors.

Someone knows what I'm doning wrong?

Kind regards, raymanP

Consent reset does not automatically remove Google Analytics cookies

@cookieconsentbutton('reset') opens modal, but clicking 'Only essentials' does not clear Google Analytics cookies. It only (re)sets the consent settings

README.md says this one

generate a button that will reset the user's cookies and show the consent modal again.

it is not now resetting cookies. Google Analytics cookies still in browser

Google Tag Manager

Hello, this is a fantastic script for Laravel.
I use Google Tag Manager instead GA4 and dont't know how to create a custom code for this script.
Searched the manual and can't find anything.

¿How can I Use this type of code?
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>

Thanks in advance

Some Sections in the Cookies View Do Not Translate Certain Parts

Thank you for the plugin; this is exactly what I was looking for for many weeks.

I encountered a minor issue in the view related to translation.

I had to make some code changes to make it work:"

+- line 37 :
From:

<span class="cookies__box">
      <strong class="cookies__label">{{ $category->title }}</strong>
  </span>
  @if($category->description)
      <p class="cookies__info">{{ $category->description }}</p>
  @endif

To:

<span class="cookies__box">
    <strong class="cookies__label">@lang('cookieConsent::cookies.categories.'.$category->key().'.title')</strong>
</span>
@if($category->description)
    <p class="cookies__info">@lang('cookieConsent::cookies.categories.'.$category->key().'.description')</p>
@endif

The same issue also exists with the cookie description, but I haven't found a way to modify it yet...
+- line 48 :

<li class="cookies__cookie">
  <p class="cookies__name">{{ $cookie->name }}</p>
  <p class="cookies__duration">{{ \Carbon\CarbonInterval::minutes($cookie->duration)->cascade() }}</p>
  @if($cookie->description)
      <p class="cookies__description">{{ $cookie->description }}</p>
  @endif
</li>

Accept buttons not working on first click

I have noticed scenarious where clicking on "Accept all" or "Accept essentials" will not work (popup box remains open). In such cases, users have to click a second time for the popup box to close.

This issue was the placement of @cookieconsentscripts - if there are other script tags of a larger size above it, the cookie box will open without the actual laravel-cookie-consent javascript being loaded, so clicking on it will throw an undefined error:

image

The solution is to move @cookieconsentscripts above all other script tags to ensure it loads first.

However, I would suggest displaying the popup box after the event DOMContentLoaded is fired

Method Whitecube\LaravelCookieConsent\CookiesRegistrar::accessibility does not exist

I would like to open an issue regarding to method that appears it doesn't exits.

Following instructions as mentioned in the documentation after I try to register the cookies into boot() method it throws error exception that the method accessibility() doesn't exits.

Laravel Version - 10.13.5  
PHP Version - 8.2.7  
Composer Version - 2.5.5 

Cookie not generated after consent is given

When I load a page on my website I get the popup for cookie consent. But when you click on any accept button no actual cookie is generated. But the strange part is if you select analytics the google analytics code is generated. So the code seems to be doing something.

It does seem to work on localhost, but not when deployed

The script doesnt work when csp is enabled

I would like to have the option to add a nonce to the script tag without having to override classes.

I've tried overriding the CookiesManager getDefaultScriptTag function to add a nonce, however for some reason I keep getting the $this->shouldDisplayNotice() as true when the Cookie is in my Storage with 'consent_at' filled.

But when I make these changes in the vendor file, it's working.

Any ideas/suggestions?

Cookie not getting set

I am using Laravel 10+, with a .test domain with SSL, When I try to 'accept all' or 'only essential' the cookie is NOT getting set. I followed the instructions carefully, am I missing something? When I refresh the page, the cookie consent dialog still shows up.

CSRF middleware exception needed for some endpoint

the accept-all and essentials are using content-type text/html. it's not inject any csrf token information in the call so the calls is redirected with a 302.

You need to add these endpoint to the csrf middleware exceptions list.

Incorrect Time Calculation in Cookie Notification

I hope this message finds you well. I am writing to report an issue I have encountered with the time calculation in the cookie notification feature.

When setting the time duration using the following code: ->duration(365 * 24 * 60)
the expected result should be exactly 1 year. However, the notification displays the time as "1 year, 1 month, 1 day," which is incorrect.

Expected Result:
The notification should display the time as "1 year."

Actual Result:
The notification displays the time as "1 year, 1 month, 1 day."

This discrepancy may confuse users and affects the accuracy of the information provided.

Accepting cookies doesn't save the choice

Hey,

I followed the documentation and configured everything but whenever I click 'Accept all' , or the other choices for the cookies it returns something like:

scripts:  ["<script async src="https://www.googletagmanager.com/gtag/js?id=test"></script>",…]
status:  "ok"

but later whenever I refresh the page, or just open another link from the menu it pops again the modal.

Anything where I may be wrong?

Consent Cookie Always Secure

Hi - love this package by the way!

When recently testing my app locally using a non-seucre localhost alias (e.g. http://myapp.test) I encountered a problem whereby consenting doesn't result in a cookie being set.

I believe this to be due to the consent cookie being forced to be secure: true. This works fine in production, and it appears browsers allow it in localhost, but when using an alias through altering the hosts file etc, every time my page reloads it pops up as the consent cookie doesn't get set. Additionally, I think if people want their site to operate over http for some reason, then this currently wouldn't work for them either.

I see two possible solutions; respecting config('session.secure') (I think this should just require removing the explicit secure: true here as the CookieJar will use this setting by default), or setting secure: false when the environment is local (or not production)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.