Overview
Fern allows you to add custom JavaScript to your documentation site through thedocs.yml
configuration file. This enables you to include the CustomerOS tracker across all pages.
Installation
Get the JavaScript snippet from the CustomerOS app - it’s specific to your domain so that you aren’t blocked by adblockers and privacy modes.-
In your Fern project, create a JavaScript file for the tracker:
-
Open
fern/js/customeros-tracker.js
and paste the JavaScript code from the CustomerOS app -
Update your
docs.yml
file to include the custom JavaScript: -
Commit and push your changes:
- Deploy your Fern documentation
Make sure the path in your
docs.yml
correctly points to your JavaScript
file location.Verifying Installation
After deploying your site:- Visit your Fern documentation
- Open your browser’s developer console (F12 or right-click → Inspect)
- Check the Network tab for a request to your tracker domain
- Look for successful 200s and 202s from the tracker subdomain
- Check the Console tab for any errors
Troubleshooting
If the tracker isn’t working:- Ensure the JavaScript file path in
docs.yml
is correct - Check that you’ve deployed the changes to your Fern site
- Verify that your tracker domain is correct and accessible
- Check the browser console for any JavaScript errors