The monitoring script: what it does and where to find it
On this page
The monitoring script is the small piece of JavaScript Tapper Block runs on your website. Each protected entity has its own script, with the entity's key filled in.
What the script does
Block judges an ad click partly by what the visitor does on your site. The script runs on every page and records how each visitor behaves and which device and browser they use. These rule set settings (Setup > Rule sets) need it:
| Detection setting | What it needs from the script |
|---|---|
| Block suspicious click behavior | The recorded behavior of each visitor, to judge whether a click came from a valid or an invalid source. |
| Suspicious ad clicks | Whether a click was followed by any events on the page. |
| Minimum seconds on site | How long the visitor stayed on your site. |
| Block JavaScript-disabled browsers | The fallback image in the script, which loads only when JavaScript is off. |
| Block repeat clicks from one device | The device ID, to spot one device clicking your ads from several IPs. |
| Aborted ad clicks | Whether your page loaded and recorded any events after the ad click. |
Conversions and web click tracking links rely on it too.
Where to find it
- With more than one protected entity, pick the entity in the switcher at the top of the sidebar.
- Under Setup, click Website, then Monitoring.
- Open the Install script and consent tab. Monitoring script is the first section.
If the tab asks you to connect an ad platform first, connect an ad account to the entity.
The same script appears in setup, at Install website monitoring. If you installed it then, you do not need to install it again.
The snippet
<!-- Tapper Monitoring Script -->
<script>
var script = document.createElement("script");
script.src = "https://monitor.tapper.ai/bundle.js";
script.async = true;
script.onload = function () {
window.tapper.init("{public key}");
};
(document.head || document.body || document.documentElement).appendChild(script);
</script>
<noscript>
<img src="https://protect.tapper.ai?pk={public key}" alt="Tapper"/>
</noscript>
<!-- Tapper Monitoring Script -->
The app fills in {public key} for you, so always copy the script from the app. How it loads without holding up your page is in Does the monitoring script slow down my website?
The section has:
- A copy button at the top right of the code box, which copies the snippet with your key.
- Google Tag Manager, which opens tagmanager.google.com.
- A Content Security Policy box listing the sources your site must allow if it sends that header.
- Open the install guide, under "Need help installing the monitoring script?", which opens the Monitoring Script guide on docs.tapper.ai.

Where it goes on your site
Install it once on every page, one of these ways:
- Directly in your HTML. Paste it right after the opening
<body>tag, in the template every page shares. - Google Tag Manager. See Install the monitoring script with Google Tag Manager.
- Shopify. See Install Tapper on a Shopify store.
- PrestaShop. The PrestaShop snippet under Conversion script replaces the monitoring script, so install that one only. See Install the conversion script: GTM, Shopify, PrestaShop or JavaScript.
On WordPress or another site builder, use Google Tag Manager or the builder's option for adding code right after the opening <body> tag.
After you install it
- If your site sends a Content Security Policy header, the browser can refuse the script. See Allow Tapper in your Content Security Policy.
- If your site asks for cookie consent, set the cookie policy on the same page. See Cookie policy, consent snippets and recognizing visitors without cookies.
- Check that the monitoring script is working on your site.
Related
Was this helpful?
Still need help?
Chat with our team and mention this article.