Tracking

Clicks

Count clicks on buttons, links and sections by tagging them with data-numbers-id, and read each element's click rate.

2 min read

Give an element a stable id and numbers counts its clicks:

<a href="/pricing" data-numbers-id="hero_cta">See pricing</a>

A click on the element, or on anything inside it, is a click event with the id as its scope (hero_cta). The script and the SDK's autoTrack() listen for these clicks; nothing else is needed.

autoTrack({ outbound: true }) also sends outbound_click for links to another site, and downloads: true sends file_download for links to a file. With a data-numbers-id on or around the link, both use that id as their scope; otherwise the scope is the destination (https://shop.example.com/pricing) or the file name, and the event carries link_domain (the other site's host), or file_name (without its extension) and file_extension, as parameters for grouping. A link with download counts as a download; a URL ending in an image extension does not, since a browser shows those inline.

What these can't see: a form sent with form.submit() (no submit event fires — call numbers.formSubmit(form) there), a submission the page prevents (it still counts), a link that isn't http(s) (a blob: or data: URL has no address or file name to read, even with download), and anything inside an iframe (it is a separate document; the script has to run there too).

Use ids that stay the same when the text changes: hero_cta, footer_signup, pricing_pro_plan. A tag on a section counts clicks anywhere inside it; the innermost tagged element wins.

Click rate

Clicks in the dashboard lists the most clicked elements with:

  • Clicks: how often it was clicked.
  • Click rate: of the visitors who viewed a page the element was clicked on, the share who clicked it.

In Obelism Content

Content tags each block with its _uid, so the canvas shows every block's click rate. On your own site, put the block's _uid on its element:

<a href={block.link} data-numbers-id={block._uid}>
	{block.label}
</a>

On this page

Marks in the margin

  • Note
  • Watch out
  • Updated

Scribes marked doubtful lines in the margin. That practice is called obelism.

Stuck on a step?