Docusaurus

Key Do’s and Don’ts

✅ Install the JavaScript code below in the Documentation.

✅ Insert the JavaScript in the root index.html page of your documentation webpages.

❌ Do Not install the Reo.Dev tracking code more than once on a single page.

Install JavaScript code in your documentation webpages

  1. Copy the above JavaScript code snippets (provided below)

  2. Go to the root index.html page of documentation webpages

  3. Paste the javascript code snippet before the closing tag in the HTML code of your webpage

  4. In case, there are multiple index.html pages that house child routes, include the code once on each page

circle-info

Please note:

  • Do not install the Reo.Dev tracking code more than once on a single page.

  • Please make sure the correct JavaScript code is copied for Docs pages.

Javascript Code Snippet for Docs

Create a custom js file and place the reo initiation script in it. Make sure to place the newly created file in scripts or js folder inside of static folder

!function(){var e,t,n;e="XXXXXX",t=function(){Reo.init({clientID:"XXXXXX"})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.async=!0,n.onload=t,document.head.appendChild(n)}();

Next, we can leverage the object format in scripts attribute in docusaurus.config.js and include the path to newly created js

Verify successful installation of Javascript on documentation webpages

  1. Open a page on your documenation and right-click anywhere on the page.

  2. In the dropdown menu, select Inspect.

  1. In the elements tab, Use the Ctrl + F or Cmd + F and search for “reo.dev”

If the tracking code appears, verify that the code matches.

FAQs

chevron-rightDoes the JavaScript code introduce any vulnerabilities or risks to the documentation?hashtag

chevron-rightDoes the JavaScript code use external dependencies or third-party libraries?hashtag

chevron-rightHow does JavaScript handle user privacy? Is there a potential risk of collecting personally identifiable information (PII) without proper consent?hashtag

chevron-rightWhat impact will including this JavaScript have on the page load times of my documentation?hashtag

chevron-rightHas the JavaScript been tested on different browsers and devices to ensure cross-platform compatibility and consistent behaviour?hashtag

chevron-rightWill the inclusion of this JavaScript affect the overall user experience of the documentation, for example, slow down UI interactions or cause unexpected behaviour?hashtag

chevron-rightAre there any fail-safe mechanisms in place to prevent scripts from disrupting critical functionality in the event of an error?hashtag

chevron-rightWill the JavaScript code continue to perform optimally as the website traffic and user base increase over time?hashtag

chevron-rightIs your JavaScript compliant with relevant industry standards and best practices such as GDPR and CCPA for data protection and user consent?hashtag

Error Scenarios

  • Script initiationScript initiation has been modified to rely on code initiation only on successful callback post download from CDN. So it will only initiate if successfully downloaded. In case the download fails, the docJS won’t get enabled but this eliminates the likelihood of an error scenario of page breaking.

  • API failure on token deleteOn deletion of all Reo tokens, the most recent event tracking data will likely fail, but subsequent API calls will work fine.

  • Any inadvertent code failure on JavaScriptThis should not be an issue since the code is wrapped in a try-catch block, the console may throw errors, which won’t be visible even on the console since logger would be disabled on the script.

If you need assistance with the implementation, contact your Customer Success Manager via the Slack channel or email us at [email protected]envelope

Last updated

Was this helpful?