Install Spurn on any site
One line in your page's <head> installs Spurn on any site you can edit. A server hit and conversions are optional extras that make detection stronger.
Before you start#
- Access to your site's HTML template, or a way to add code to every page's
<head>. - Your site's public key from Spurn: Sites, then your site, then the Install tab (it is also on the Keys tab). It looks like
sp_pub_XXXXXXXXXXXXXXXXXXXXXXXX.
1. Add the tag#
Put this in the <head> of every page:
<script async src="https://spurn.io/s.js" data-site="sp_pub_XXXXXXXXXXXXXXXXXXXXXXXX"></script>
If your tool can't add attributes to a script tag, set the key first:
<script>window.spurnConfig = { site: 'sp_pub_XXXXXXXXXXXXXXXXXXXXXXXX' }</script>
<script async src="https://spurn.io/s.js"></script>
It needs to be on every page, not only your landing pages. A paid visitor often lands on one page and buys on another.
What the tag does:
- On organic visits, nothing. It sends no request at all.
- On a paid landing (a URL with an ad click id such as
gclidormsclkid, or paid UTM tags such asutm_medium=cpc), it scores the visit and reports how the visitor engages. - On later pages of that paid session, it reports engagement. The session ends after 30 minutes without activity.
- It writes a first-party cookie,
_spc(30 days), and a visitor id in local storage,_sp_v, so conversions can be matched to the click. - It exposes the verdict as
window.spurn.verdictand pushes{ event: 'spurn_verdict', spurn_verdict, spurn_score }todataLayer. See /docs/install/google-tag-manager for using it.
2. Report conversions (optional)#
On your thank-you or order confirmation page:
<script>
window.spurn = window.spurn || function () { (window.spurn.q = window.spurn.q || []).push(arguments) }
spurn('conversion', { value: 49.9, currency: 'USD', orderId: '1001' })
</script>
The first line queues the call if the tag hasn't loaded yet. value is in major units (49.9 for $49.90). orderId should be unique per conversion. Only visitors who arrived on a paid click are reported; for anyone else the call does nothing.
If your server knows when an order is paid, sending the conversion from there is more reliable, because it doesn't depend on the shopper reaching the thank-you page: /docs/install/server-api.
3. Send server hits (optional)#
A server hit gives Spurn the visitor's IP from your server, even when the page's JavaScript never runs, which is how bots that skip scripts get caught. If your site runs on WordPress, Next.js or behind Cloudflare, use /docs/install/wordpress, /docs/install/nextjs or /docs/install/cloudflare. For anything else, see /docs/install/server-api.
For Google Ads and Microsoft Ads, the tracking template records the IP behind each click with no code on your site: /docs/guides/tracking-template.
Check it works#
- Add your own IP address to the allowlist in Spurn (Blocking, then Allowlist), so your tests are never blocked.
- Open your site with a test click id:
https://yoursite.com/?gclid=test-123. - Open Clicks in Spurn. The visit appears within a minute, and the site's Install tab shows Receiving.
A test landing counts as a real paid click and uses one credit.
Troubleshooting#
Nothing arrives. Check the test URL has a click id; visits without one are ignored by design. Check the key starts with sp_pub_.
Clicks are rejected for the wrong site. Spurn checks the page's origin and landing host against your site's domain and extra hosts. Add every domain the site answers on, such as www. or a regional domain, in Sites, then your site.
Content Security Policy. Allow script-src https://spurn.io and connect-src https://spurn.io.
Ad blockers. They can stop the tag in your own browser. Test in a private window without extensions. Server hits and the tracking template aren't affected.
Consent banners. If your consent tool holds scripts until the visitor accepts, the tag waits too, and visitors who decline aren't checked by it.
Wrong key. The tag takes the public key. A secret key (sp_sec_…) must never go in a page; if one did, revoke it in Sites, then your site, then Keys.
What data is sent#
On paid landings only: the landing URL and referrer, the IP address and user agent, browser signals used to spot automation, Meta's browser ids when the Meta pixel set them, and engagement such as time on page, scrolling and interactions. Conversions send the value, currency and id you give them. See /docs/detection and /docs/api.