0

We run a SAAS analytics app similar to hotjar and Google Analytics. The customer needs to install our javascript on their website in order for us to track.

How do we validate if this script has been successfully installed on their site and it loads? (We know the domain)

(The current approach is to call an API from the script on load) and (the second approach is to scrape the page to verify if the script exists)

The script will pass an API post if it loads. However, if the script is used in any test site then it may create a false load. I am wondering what the industry standard is here as this scenario is used across all the installation script sites.

1 Answers1

0

As first glance I would:

  1. Do a script which parse the page and checks if the script is added in the header.
  2. Check if the script to be loaded is in the footer and of course when the page is loaded to run.
  3. To avoid false positives, use a unique identifier on the page that is not used in the development. ie. get location.host variable from the script and pass it on to the analytics to verify.