Can I add custom code or scripts to the head of my website?
Solo allows you to add a custom script to the <head> section of your website. This feature requires a Pro or Grow plan and a connected custom domain. With custom scripts, you can extend your Solo website with functionality such as a chatbot, animations, analytics or other apps. We currently have tested with a range of example scripts but are continuing to test with more.
The head code field supports up to 10,000 characters. In addition to <script> tags, you can also use <style> and <link> tags (e.g. to load external stylesheets or fonts).
Note: Custom scripts require a connected custom domain and cannot be previewed via the Preview button in the top toolbar nor on your soloist.ai/handle. They will only be loaded on your custom domain (e.g. yourdomain.com).
You can add a custom script to your Solo website by following the steps below:
- Visit the designer
- In the top toolbar, click
Settings - In the Settings right sidebar, scroll down, and toggle on Custom code
- In the modal that appears, you can add your custom code (e.g.
<script>) - Click
Save - In the right top toolbar, click
Publish
Where is the custom code inserted?
The custom code or script will be inserted into the <head> section of your website for all pages. If you wish to insert custom code directly into a section of your website, you can use the code embed section.
Do async and defer attributes work?
Yes, async and defer attributes should work.
What about CORS?
We do enforce CORS. You can try adding the "no-cors" option to your fetch calls, but keep in mind that it has limited usefulness since you won't be able to read the response. This mode is mostly helpful when the request is used for things like tracking or analytics, where the response data isn't needed.
CDNs and other image hosting providers often add the header "access-control-allow-origins: *" and so they are not impacted by CORS.
Can I add custom CSS?
You can also link to externally hosted CSS files to change the styling of your website, but this may yield mixed results.
If your custom <script> doesn't work, please contact us at support@soloist.ai and we may investigate. We do suggest testing your script first with JSBin or if you are importing scripts, host them at Netlify Drop.
Related Articles
Related Articles
Still have a question? Post to our Reddit group or email the team.