Install
Add a website, paste one script and check that visits arrive. About five minutes, on any site that runs JavaScript.
Add a website
In the dashboard, open Traffic Analyzer, then Websites, and click Add website.
- Name: anything that helps you recognise it, like Shop.
- Allowed origins: every origin the script runs on, one per line. See Allowed origins below.
- Mode: Full (the default) recognises returning visitors with a first-party id in their browser. Strict never stores anything in the browser. See Privacy and data.
- Automatically block bots: off by default. You can turn it on later. See Auto-block.
You get a website key that starts with sk_. It is public and goes in your pages. There is no secret.
Add the script
Open the website's Setup page. Every snippet there already has your website key in it. Pick your platform below, or copy it from the dashboard.
Load the script on every page you want scored and protected. Blocking only works on pages that load it.
Check that it works
Keep the Setup page open and visit your website in another tab. Move the mouse and scroll for a few seconds. The Install status card checks every 5 seconds:
- Script loaded turns green when the first visit arrives, with the page it came from.
- First visit scored turns green a few seconds later, with the verdict and score.
The status at the top changes from Waiting for first visit to Receiving traffic. Still waiting after a minute? See Troubleshooting.
Look at your visits
Open Sessions to see each visit, its score and the reasons behind it. See Use the dashboard.
The snippet for your platform
Replace sk_your_website_key with your website key.
Paste this before the closing </body> tag of every page.
<script src="https://s.geoiphub.com/v1/traffic.js" defer></script>
<script>
window.addEventListener("DOMContentLoaded", () => {
geoiphub.init({ websiteKey: "sk_your_website_key" });
});
</script>Allowed origins
Our edge network accepts a visit only when the page's origin is on the website's list. Copying your website key onto another site does nothing.
| You enter | Matches | Does not match |
|---|---|---|
https://shop.example.com | https://shop.example.com | https://example.com, https://www.shop.example.com, http://shop.example.com |
https://*.example.com | https://www.example.com, https://a.b.example.com | https://example.com (add it separately) |
http://localhost:3000 | http://localhost:3000 | http://localhost:5173 (ports must match) |
- Use
https://for real sites. Plainhttp://is only accepted forlocalhostand127.0.0.1. - Enter the origin only: no path, no query and no trailing slash.
- Up to 20 origins per website. Changes reach our edge network within seconds.
- For local testing, add your dev server's origin, like
http://localhost:3000, and remove it when you go live.
Single-page apps
Call init once, when your app first loads. The script then runs for the whole page load: it keeps watching behaviour across client-side route changes, and a block screen stays up when the route changes. A second init call does nothing, so frameworks that re-run effects are safe.
One page load is one session. Client-side navigation does not start a new session. A visitor you block sees the block screen from their next full page load.
Performance
- About 20 KB compressed. It loads with
deferorasyncand never blocks rendering. - Its work runs when the browser is idle. It shows nothing and asks the visitor for nothing: no widget, no puzzle, no permission prompt.
- It never throws errors into your page.
- It fails open: if our service is slow or down, visitors are let in and your page works as usual.