#Installation

The Audit.js script is a hosted script that, in conjunction with Access.js, will allow to track a few more events regarding your site.
It is required when planing to use native segmentation.
Historically, this was automatically done by the poool() method alongside creating a new paywall. In order to be able to display a paywall without using native segmentation, the Audit.js script is now a standalone entity.

#Load the script

Like Access.js, the Audit.js script can be loaded in a lot of different ways.
We will purposely not cover the React implementation here as we already manage everything automatically for you in @poool/react-access.

ℹ️ If you are using Content Security Policies on your site, make sure to add https://*.poool.fr (or the api, assets and cdn subdomains if you are not comfortable with wildcards) to your whitelist in order for the script to operate normally.

While sync mode is easier to read and use, we recommend using async mode to avoid any unwanted side effects to your browser when the script is loading.

#Use both Audit.js and Access.js

Audit.js has been created as a sister library to Access.js and will thus be automatically detected by Access.js in your page. Access.js will wait for Audit.js to be ready to ensure they both use the same user identifier.
However, if you hate magic and like to do things your own way, you can disable the default behavior using Access' skip_audit_loader configuration option and manually listen for Audit's identityAvailable event.

#Track conversions

If you want to track conversions on your site and the conversion occurs on a page where there is no wall to display, you will need to integrate Audit.js alone and to send a conversion event. See the documentation for the conversion event.