All Collections
Plug-in and CMS guides
Single-Page Applications (SPA)
Single-Page Applications (SPA)

Cookie Information consent pop-up implementation guide for Single-Page Applications

Piotr avatar
Written by Piotr
Updated over a week ago

Pop-up implementation

If you have a Single-Page Application (SPA), like React.js, Vue.js, or Angular.js, you can use the following implementation guide based on the React.js example.

1. Create a react app in your desired location using the following command:

npx create-react-app app-name

2. A directory called app-name is created with the following default file: index.html

3. Open index.html inside the public directory and add the following script to the <head> tag:

<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="EN" type="text/javascript"></script>

4. Save changes and reload the bundle.js.

Reload the consent framework

In a single page application, most elements are loaded or updated asynchronously. You can use the function below to reload the whole consent framework when needed.

window.CookieInformation.loadConsent();

Related articles:

Did this answer your question?