Website script
The Argus website script counts visits and the actions you care about, measures how fast your pages feel, and serves feature flags. It sets no cookies and Argus never stores visitors' IP addresses.
Adding the script
Under Argus → Sources, each browser source has a Website script card
with its tag. Paste it into your page's <head>:
<script
defer
src="https://argus-in.naijacloud.com/sdk/v1/argus.js"
data-key="<public key>"
></script>data-key is the public key from the source's
DSN. It is public by design, because it lives in
the browser. To stop other sites sending with it, list your own sites under
Sites allowed to use this key on the same card.
Web analytics on that card switches page-view collection on or off for the source. Changes take effect on the next page load, with no new script to ship.
Options
| Attribute | Default | What it does |
|---|---|---|
data-key | none (required) | The source's public key. Without it the script sends nothing |
data-env | production | The environment the visit belongs to. Feature flags are evaluated for this environment |
data-persist | off | Set to local to keep an anonymous visitor ID in localStorage, so returning visitors are recognised across days |
data-persist="local" stores an identifier in the visitor's browser. If you
turn it on, your site needs its own consent notice. That is why it is off by
default.
What it collects on its own
- Page views, including navigations in single-page apps. The referrer and
any
utm_source,utm_mediumandutm_campaigntags are taken from the first page of a visit. - Web Vitals: LCP, INP, CLS, FCP and TTFB.
- Rage clicks: three or more clicks in the same spot within a second.
- Dead clicks: a click on a button or link that changes nothing for a second.
Privacy
Privacy is decided on the server, so a modified script can't weaken it:
- No cookies, and no IP addresses stored. A visitor is a code made from
their IP address and browser that changes every day and can't be turned back
into either. The script keeps only a per-tab session ID in
sessionStorage. One consequence: someone who visits on three days counts as three visitors in a week. - Paths, not URLs. Query strings and fragments are dropped, and the referrer is kept as a host only. Emails, card numbers and tokens are blanked in paths and event properties.
- Bots are dropped: crawlers, monitors and scripts are not counted.
- The visitor's country comes from the request's edge location data.
Your site is the controller for your visitors' data. Use these facts to update your own privacy notice.
Custom events
argus.track('checkout_paid', { plan: 'pro' }, { revenue: 25000, currency: 'NGN' });argus.track(name, properties, options) records an event with optional
properties. options takes value, revenue and currency. Events you send
count against your plan's monthly analytics allowance, shown under Argus → Usage & plan.
Identifying signed-in users
argus.identify(user.id); // when someone signs in
argus.reset(); // when they sign outArgus stores a hash of the ID, never the ID itself. Identified people are what retention and experiments count; anonymous visitors change every day, so they are left out of retention.
Calling it before the script loads
The tag uses defer, so window.argus doesn't exist until the page has
parsed. Queue calls in window.argusq and the script runs them when it loads:
<script>
window.argusq = window.argusq || [];
argusq.push(['track', 'signup_started']);
</script>Feature flags
Create flags under Argus → Flags. A flag is on/off or has several variants with weights, and is set per environment with a rollout percentage and optional rules on attributes your app passes.
argus.onFlags(() => {
if (argus.flag('new-checkout', 'off') === 'on') showNewCheckout();
});argus.flag(key, fallback)returns the variant this visitor gets, orfallbackwhen the flag doesn't exist. The first read of each variant on a page is recorded as an exposure, which is what experiments count.argus.onFlags(callback)runs once flags have loaded.argus.reloadFlags(attributes)evaluates the flags again with attributes for your rules, such as{ plan: 'pro' }.
A visitor keeps the same variant: raising a rollout never takes a flag away
from someone who already had it. Calling argus.identify reloads flags for the
signed-in user.