klaro-org / klaro-js

Klaro Privacy Manager. An open-source, privacy-friendly & compliant consent manager for your website.

Home Page:https://klaro.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Klaro with React-gtm-module and React-Hotjar

nathanguillaumin opened this issue · comments

Hello,

I am using React and Nextjs and some modules such as react-gtm-module and react-hotjar to track and get analytics.

I am wondering how it would be possible to include the use of the modules within the configuration of Klaro. Is it possible to take them as cookies as the other <script /> ?

Thanks for your help!

Hi @nathanguillaumin! I don't know how those libraries load their scripts, but I think the easiest way to load them would be to add onAccept and onDecline handlers to the service configs in Klaro, and make those handlers load the scripts. Do you plan to use Klaro by importing it in your code?

Hi @adewes, thanks a lot for your help.

I actually processed differently.

I added these scripts in my klaroConfig.js as services with their names and the cookies. Then, in my _app.tsx, where I called my scripts hooks (see for example how works react-hotjar), I wrote a condition and launch them only if user accepts the consent of this particular service thanks to the getConsent function: manager.getConsent('hotjar')

Great approach, that works as well! Can I close this or is there another problem you're facing?

Everything is ok, you can close it, thanks :)