Minimal Cobrowse Script
  • 19 Mar 2023
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Minimal Cobrowse Script

  • Dark
    Light
  • PDF

Article summary

Miniminal Cobrowse Script

Page load time is important and so Cobrowse was developed to minimize the page load by splitting the script into the bootstrap and core scripts. The bootstrap script is all that is necessary to include in a page to begin a Cobrowse session as it pulls the down the Cobrowse core script when a session is actually requested.

The intent of the Bootstrap script is that it would always be present in a page to provide mechanisms to begin a session. However, for customers who are trying to absolutely reduce the page load time to the minimum. We have an even smaller script available, less than 1kb compressed which does not need to be loaded into the page until a session is requested or an existing session has been established.

Setup

The scripts are availble here:

https://cobrowse-ci.screenmeetdev.com/dynamicCobrowse.min.js
https://cobrowse-ci.screenmeetdev.com/dynamicCobrowse.js

The scripts must be downloaded and edited before uploading to your website. Once you have created a Cobrowse deployment key then you must replace the string "YOUR_DEPLOYMENT_KEY" with the 6 letter deployment key. 
To get an Deployment Key you must access the Screenmeet console as an organization administrator and go to the Cobrowse Deployments tab menu to configure your deployment keys and associated domains.

It is recommended to add the deployment key or the environment name to the file name to help distinguish the script in different environments. Like renaming it to dynamicCobrowse.YYYZZZ.min.js or dynamicCobrowse.production.js

Behavior

If the script is added to a page then it will automatically open the Cobrowse modal requesting a session pin. If a session is already present then instead of opening the modal it will automatically continue the session.

If the localstorage or sessionstorage key SMCobrowse is present the page then there is an active session and the dynamic script should be loaded.

Once the script has loaded it also provides the following function to open the modal in the situation that either the previous modal was closed in error or a new session is required.

window.Cobrowse.beginCobrowse() - This will inject the full cobrowse scripts (once per page load) and open the cobrowse modal.

Security

If you do not wish to make a page Cobrowsable then not including the script in the page will prevent that page from being shared, however, the agent will be shown a waiting spinner until the customer returns to a Cobrowsable page. Alternatively, if a page contains sensitive information then you can use our masking system so the data never leaves the customer's machine. Cobrowse PII


Was this article helpful?