Integrating the Virtual Assistant Script in Liferay ensures that the Assistant’s window displays correctly during every page change within the application. Due to Liferay's SPA (Single Page Application) navigation, the Assistant’s window might not load properly, leading to its absence in some cases.
Find below the steps for implementation:
Key consideration: Defining aivo within window.Liferay.aivo is essential to manage the behavior of the Assistant’s window. This ensures the Assistant remains available during navigation, without losing context or duplicating scripts.
1) Customize Script Variables
- Update the variable TOKEN with the token from your account.
- Insert your custom styles in the designated variable to style the Assistant.
- Provide the appropriate CDN link for your account.
2) Configure the Script in Liferay
- Copy and paste the Script to make it globally available across the site. To do this, include it in the Liferay theme files.
Download the example Script here.
Benefits of Implementation:
- Dynamic and Asynchronous Loading: The script loads only when necessary and asynchronously, preventing duplication and ensuring the Assistant’s window appears automatically when users access the site for the first time.
- SPA Navigation Support: The Virtual Assistant window will display automatically after each page change, ensuring its consistent availability throughout the navigation process.
- Customizable Styles: Using the shadowRoot, you can apply styles to the Assistant’s elements without causing conflicts.
- Authenticated User Management: If needed, the Assistant’s window can be automatically hidden in restricted areas where the user is already authenticated.
Note: For technical support regarding implementation, style customization, and configuring experiences for authenticated users, contact us via our Aivo Support Center.