To create a new React project, run on the terminal:
npx create-react-app my-app
To run the newly created app, on the terminal go to the my-app directory and run on the terminal:
npm start
We assume that you have node.js installed on your computer.
Assuming that you have a React App already working, you can implement our Usercentrics Script in the following way:
CMPv3 Implementation
Open
index.htmlinside the public directory-
Add the following script to the
<head>tag:<!-- Change 'XXXXXXXX' to your settingsID --> <script id="usercentrics-cmp" src="https://web.cmp.usercentrics.eu/ui/loader.js" data-settings-id="XXXXXXXX" async> </script>
CMPv2 Implementation
Open
index.htmlinside the public directory-
Add the following script to the
<head>tag:<!-- Change 'XXXXXXXX' to your settingsID --> <script id="usercentrics-cmp" data-settings-id="XXXXXXXX" src="https://app.usercentrics.eu/browser-ui/latest/loader.js" async> </script>