Scout Copilot
Before implementing this code, ensure you have configured a Copilot within the dashboard. Navigate to the /dashboard/integrations page to create a new Copilot. The Copilot’s id
can be obtained from its detail page.
Adding the Widget to Your Website
To incorporate the Copilot module into your application, insert the following code:
After these steps, the Copilot component will be visible on your website.
Below, you’ll find descriptions of different attributes that can be applied to the Copilot component. These attributes can be added directly to the co-pilot
tag.
For instance, to conceal the Copilot, you can set the show
attribute to false
:
Required Attributes
The copilot_id
is the unique identifier of the Copilot, available on the Copilot’s detail page. This ID is required for proper functionality.
Optional Attributes
Specifies the Copilot’s environment, which defaults to "development"
. Set this to "production"
when deploying your application.
Identifies the user interacting with the Copilot. If not set, a random ID will be generated and stored in local storage.
Determines whether the component is visible. The default value is true
.
Indicates whether the Copilot is open. It defaults to false
.
Specifies whether the minimize button is visible, with a default value of true
.
The height of the Copilot component. The default value is "40vh"
.
The width of the Copilot component. The default value is "25vw"
.
Specifies the maximum width of the message bubble. Defaults to "95%"
.
The height of the floating action button (FAB). Defaults to "40px"
.
The width of the FAB. Defaults to "40px"
.
Determines whether the Copilot is embedded directly into the application interface, rather than appearing as a floating component. It defaults to false
. See the Embedding the Copilot section for more information.
Customizing the FAB
The Copilot’s floating action button (FAB) can be customized by passing in a child html element with the slot
attribute set to fab
. For example:
In the example above we are creating a simple FAB with a white background, a shadow, and an image and text inside. You can customize the FAB to your liking by changing the styles and content.
Embedding the Copilot
By default, the Copilot will be displayed as a floating action button (FAB) in the bottom right corner of the screen. To embed the Copilot within your website, set the embedded
attribute to true
. This will allow you to position the Copilot within your website’s layout wherever you see fit.
Note: When embedding the Copilot, the open
, show
, and show_minimize
attributes will be overridden.
Example embedded Copilot:
In the example above, the Copilot is embedded within the .container
div and it is given a width of 700px and a height of 500px.