﻿# Add LiveChat to a portal

> [HTML Version](livechat-on-portal.html)

You can embed an online LiveChat on a website or portal using the **Code** widget. Let's consider an example of such placement on an [external portal](service-portal.md).

1. After  [creating a LiveChat](livechat.md), copy the **Code to embed on a website** in its settings. To do this, click **Copy Code to Clipboard**.

**(livechat_portal1.png)**

2. Go to the workspace where the portal is hosted. In the [portal settings](service-portal.md), select the page where you want to embed LiveChat.

3. Open the portal page in the interface designer. To do this, to the right of its name, click the gear icon and select **Widget Builder**.

**(livechat_portal2.png)**

4. In the page template, move the [Code widget](code_widget.md) to the modeling field.

5. In the **Code** widget settings, add the code copied in step 1.

6. Please note, that the code generated in the LiveChat settings is by default intended to be placed on a website. If you are embedding LiveChat on a portal, in the text of this code, put the \[OBJECT\] attribute on a separate line. Example code with the required changes:

````
<script src="https://domain.brix365.com/assets/livechat/assets/elma365.livechat.loader.js" type="text/javascript" charset="utf-8" elma365BackendUrl="https://domain.brix365.com/"></script>  
<script>  
  let loader = document.querySelectorAll('\[src="https://domain.brix365.com/assets/livechat/assets/elma365.livechat.loader.js"\]')\[0\];  
  loader.setAttribute('elma365LiveChatFormId', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');  
</script>

````
Where:

	- **domain** is the URL of the BRIX homepage where LiveChat is configured.

	- **XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX** is an automatically generated UUID.

7. Save and publish the changes of the portal page template.