-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add cookie consent v3 #825
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for satellytes ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
src/components/CookieConsent.tsx
Outdated
const setLeadinfoCookies = () => { | ||
const twoYears = 63072000; | ||
const sessionValue = new Date().toISOString(); | ||
document.cookie = `_li_id=some_value; max-age=${twoYears}; path=/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add more meaningful values: https://help.leadinfo.com/en/add-leadinfo-to-your-cookie-banner-solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The article explains the nature of the cookies involved. I don't think that we're supposed to set those cookies.
Instead you have to pull in the matching script through the scripts management of the cookie consent js I think ?
https://cookieconsent.orestbida.com/advanced/manage-scripts.html
I'm not sure how to distinguish the two different modes (with cookies and without). Maybe there are two different scripts possible or so?
--> If that's not a given use case to allow both scenarios (cookie and without cookies) then let's enable cookies in the backend and integrate the tracker only when the consent was given. Maybe we find a solution afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi thanks for the start,
I've provided some feedback regarding the integration.
src/components/CookieConsent.tsx
Outdated
const setLeadinfoCookies = () => { | ||
const twoYears = 63072000; | ||
const sessionValue = new Date().toISOString(); | ||
document.cookie = `_li_id=some_value; max-age=${twoYears}; path=/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The article explains the nature of the cookies involved. I don't think that we're supposed to set those cookies.
Instead you have to pull in the matching script through the scripts management of the cookie consent js I think ?
https://cookieconsent.orestbida.com/advanced/manage-scripts.html
I'm not sure how to distinguish the two different modes (with cookies and without). Maybe there are two different scripts possible or so?
--> If that's not a given use case to allow both scenarios (cookie and without cookies) then let's enable cookies in the backend and integrate the tracker only when the consent was given. Maybe we find a solution afterwards.
let leadinfoInitialized = false; | ||
|
||
const LeadinfoScript = ({ enable }: { enable: boolean }) => { | ||
const [script, setScript] = useState<HTMLScriptElement | null>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as said I think it's easier to use the script manager instead of manually bootstrapping it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
Thank you for the feedback and your time🙏. I tried to block/manage script tags according to the document you sent. You can see some FAQs in my comment below. Accordingly, when we do this, different cookies are set when analytics data is accepted by Leadinfo. The cookies are listed below possibly related to li_id and li_ses cookies in terms of tracking user sessions and identifying visitors. (like Google Analytics(_ga cookies) or HubSpot (__hstc, hubspotutk) or _hssrc session cookie)
Do you think we need to add detailed descriptions of these cookies under analytics or the relevant section?
leadinfoScript.setAttribute('type', 'text/plain'); | ||
leadinfoScript.setAttribute('data-category', 'analytics'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the leadInfo side, the cookies are already enabled.
As far as I see in the documentation when we add these two attributes, that prevents script execution until consent is given.
Cookies are enabled:
Cookies aren't enabled:
Based on the conversation with Georgios, I added Cookie Consent script from here -> https://github.com/orestbida/cookieconsent?tab=readme-ov-file
Note: We can add German translation version.
Kindly checkout the gif below: