Skip to content
Browse the docs

Tracking template

A tracking template lets Spurn record the IP address behind a Google Ads or Microsoft Ads click even when the landing page never loads.

Why it sees clicks the tag cannot#

The tag only reports a click once your page has loaded and its JavaScript has run. Plenty of invalid clicks never get that far: a bot that requests the ad link and leaves, a script that does not run JavaScript, a click farm that closes the tab straight away. Without a server-side witness, those clicks only show up later as ghost clicks from Google's click import, with no IP address to block.

A tracking template is a URL the ad platform calls every time your ad is clicked. Google and Microsoft call it from the visitor's browser, in parallel with sending the visitor to your landing page. When Spurn's URL is the template, Spurn records the visitor's IP address and user agent at the moment of the click, then sends the request on to your landing page.

If the tag reports the same click, the two merge into one click with one credit. If the page never loads, the click is scored without browser evidence and gets the Page never loaded reason. Either way Spurn has the IP, so the network can be blocked. The template also fills in the campaign, ad group, keyword, match type, network and device, before Google's hourly import arrives.

Use this as the account-level tracking template, with your site's public key in place of sp_pub_XXXXXXXX:

https://spurn.io/c/sp_pub_XXXXXXXX?gclid={gclid}&cid={campaignid}&agid={adgroupid}&kw={keyword}&mt={matchtype}&net={network}&pl={placement}&dev={device}&u={lpurl}
ParameterGoogle fills inSpurn records it as
gclid{gclid}The click id, used to merge with the tag and with Google's click import
cid{campaignid}Campaign
agid{adgroupid}Ad group
kw{keyword}Keyword
mt{matchtype}Match type
net{network}Network
pl{placement}Placement, for Display and video clicks
dev{device}Device
u{lpurl}The landing page Spurn redirects to

Keep auto-tagging switched on in Google Ads, so every click carries a gclid.

Let Spurn set it for you#

When you connect a Google Ads account that has no account-level tracking template, Spurn offers to set this one for you. If the account already has a template, Spurn leaves it alone.

Set it yourself#

In Google Ads, open Admin, then Account settings, and expand Tracking. Paste the template into Tracking template and save.

Microsoft Advertising#

Use this as the account-level tracking template in Microsoft Advertising:

https://spurn.io/c/sp_pub_XXXXXXXX?msclkid={msclkid}&cid={CampaignId}&agid={AdGroupId}&kw={keyword:}&mt={MatchType}&net={Network}&dev={Device}&u={lpurl}

The parameters mean the same as in the Google template. {keyword:} with the colon is Microsoft's syntax: it inserts the keyword, or nothing when there is none. Turn on Microsoft's auto-tagging of the Microsoft Click ID, so every click carries msclkid.

Spurn does not set the Microsoft template for you; paste it in yourself.

Final URL suffix and other templates#

Final URL suffix is a different field. It holds parameters added to the landing page URL, such as your UTM tags. Leave your UTMs there. Spurn's URL goes in Tracking template, never in Final URL suffix. With parallel tracking the shopper lands on your final URL with its suffix, and the template is called alongside, so your tag still sees the click id and UTM tags on the landing.

The most specific template wins. Google and Microsoft let you set a template at account level and again at campaign, ad group and lower levels, and a template set lower down replaces the account-level one for those ads. If some campaigns already have their own template for another tool, those campaigns will not call Spurn's. The tag and any server hits still cover them; only the clicks whose page never loads go unseen.

Spurn cannot pass clicks on to another tracker. It only redirects to your own domains (see below), so it cannot sit in front of another tool's redirect. If you already rely on another tracking template, keep it, and let the tag and server hits do the work.

Open-redirect protection#

Spurn only redirects to u when its host is your site's domain or one of the site's extra hosts. On Shopify, your myshopify.com address is added as an extra host when you install the app. For anything else, Spurn records the click and answers 204 No Content without redirecting.

This stops anyone using a Spurn link to bounce visitors to a site that is not yours. If your ads land on a domain other than your store's main one, such as a separate landing page domain, add it to the site's extra hosts first, or Spurn will not redirect to it.

Check it works#

Open the template in a browser with a test click id and your home page as the landing page:

https://spurn.io/c/sp_pub_XXXXXXXX?gclid=test-456&u=https%3A%2F%2Fyourstore.com%2F

You should land on your store. In Clicks, a Google Ads click with click id test-456 appears, seen by the server. Because the redirect drops the click id, the tag on your store treats the visit as organic and stays quiet, so after three minutes the click gets the Page never loaded reason. That is what a click from a bot that never loads your page looks like.

The test uses one credit. If you have run other tests from the same IP today, add your address to the allowlist first, or the repeat clicks will be flagged.