matthewmueller / next-cookies

Tiny little function for getting cookies on both client & server with next.js.
368 stars 17 forks source link

Any working example of this package as cookies consent banner? #48

Closed kamal-choudhary closed 2 years ago

kamal-choudhary commented 2 years ago

Thanks for this useful package.

I have a static website in Next.js and I have two scripts in it i.e. Google Analytics 4 & TruConversion Heatmap.

Both of these scripts are implemented using the newest next/script component.

When the user loads my website, I want to show the cookies consent banner (with accept/reject button), if the user accepts then I want my scripts i.e. GA4/Heatmap to run otherwise don't run those scripts.

Has anyone implemented something like this using this package, I'll be very thankful if someone can share a code snippet OR just guide me in the right direction?

nfriedly commented 2 years ago

Hi @kamal-choudhary,

I'm not aware of any examples of that, however it shouldn't be too difficult to roll your own. That said, I would probably just use a third party one.

kamal-choudhary commented 2 years ago

Hi @nfriedly ,

I'm so sorry for the delayed response.

The truth is that I used another library and it served my purpose.

So, I couldn't test this library.

Thank you so much for your time.