Centinel AnalyticaCentinel Analytica

Scripts

You should include the Centinel Analytica scripts onto each page that contains a protected endpoint. For example if you are protecting the login endpoint, you should add the scripts to the login page, but also every other page that contains the login form.

To include the scripts on a page, add a HTML script tag immediately below the <head>. Make sure to replace SITE_KEY with your site key.

<html>
    <head>
        <script src="https://collector.centinelanalytica.com/script.js?site_key=SITE_KEY"></script>
        <!-- Rest of the head -->
    </head>
    <body>
        <!-- Page content -->
    </body>
</html>

Waiting for Centinel Analytica

In order to ensure that Centinel Analytica has finished loading the script and is ready to protect your website, you should wait for window.cen.initialized to be true and if not wait for the "CentinelInitialized" event to be fired.

if (window.cen && window.cen.initialized) {
    login();
} else {
    window.addEventListener('CentinelInitialized', login);
}