Next Applications

circle-exclamation

Javascript Code Snippet for Next Applications

You may leverage dangerouslySetInnerHTML to set the snippet inline

import Script from 'next/script';
<Script
  id="reo-script"
  strategy="afterInteractive"
  defer
  dangerouslySetInnerHTML={{
    __html: '!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.defer=!0,n.onload=t,document.head.appendChild(n)}()'
  }}
/>

If you want to avoid inline, you can create a custom file and reference it in src

import Script from 'next/script';
<Script src="/path/to/reo-script.js" strategy="afterInteractive" />

And put the snippet directly in the custom js file


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

The JavaScript code has been tested thoroughly to ensure that it does not introduce any vulnerabilities or risks to the website. Data sent by the JavaScript code is encrypted using the HTTPS protocol to ensure secure transmission and prevent unauthorized access.

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

The JavaScript code uses secure third-party libraries that have been thoroughly checked for vulnerabilities and risks.

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

It is designed to collect anonymous data such as browser information, page views, copy and click events without collecting any PII.

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

The code has been optimized to minimize any negative impact on page load time and performance. This code uses asynchronous loading technology so it can load independently without blocking the rendering of the page content.

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

The JavaScript code is thoroughly tested on multiple browsers (Chrome, Firefox, Safari, Edge, Brave) and devices (desktop, mobile) to ensure compatibility and consistent behaviour.

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

It doesn't affect the overall user experience. It will not slow down, or introduce any intrusive elements that have an impact on the experience.

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

We have implemented fail-safe mechanisms in the JavaScript to prevent scripts from interrupting the website's critical functionality in the event of an error, thus ensuring a smooth user experience.

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

The code is optimized for scalability. The JavaScript code is designed to scale as your online traffic and user base grow. It will continue to work best even as traffic to your site increases. There are no significant limitations or performance bottlenecks associated with the tracking mechanism.

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

The JavaScript code adheres to relevant industry standards and best practices, such as GDPR and CCPA, regarding data privacy and user consent.

Error Scenarios

  • Script initiation

    Script 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 delete

    On 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 JavaScript

    This 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?