viakite
Dashboard

Guides/Dashboard/Heatmaps

Heatmaps

Where visitors click and how far they scroll

Analytics → Heatmaps shows where visitors click on a page and how far down they scroll, for desktop, tablet and phone widths. It is off until your site loads the heatmap script, a second script next to the Viakite one, so sites that don't use heatmaps never download it.

Turn heatmaps on

Add the heatmap script to every page, next to your Viakite script, with the same data-project key. The script's address is the Viakite script's address with h.js in place of a.js:

index.html
1<script defer src="https://us.api.vk.viabio.me/v1/a.js" data-project="pk_live_us_…"></script>
2<script defer src="https://us.api.vk.viabio.me/v1/h.js" data-project="pk_live_us_…"></script>

Copy the address of a.js from the Install page and change its end to h.js. The Heatmaps page shows the tag for your project when it has no data yet.

The heatmap script reads the same attributes as the Viakite script: data-api, data-hash, data-params, data-localhost and data-debug. Give it the same ones. Through a proxy, load it from /va/h.js with data-api="/va/e", like the Viakite script, and forward /va/h.js to your region's API host the same way as /va/a.js. The proxy configs the Install page gives forward only /va/a.js and /va/e, so add a line for /va/h.js (a proxy that forwards all of /va/*, such as the CloudFront behaviour, needs nothing more; the Cloudflare Worker checks the path, so add /va/h.js to its check).

Script tag only

Heatmaps work with the script tag today. @viakite/sdk from npm and the React, Vue and Svelte components don't record clicks for heatmaps yet; add the script tag above alongside them.

What it records

For each page view:

  • Clicks: where on the page, as a share of the page's width and pixels from its top, the width of the browser window, and the clicked element as a short CSS selector (its tag, id and up to two classes, such as button#buy or body > nav > a.nav-link). It never reads text, what was typed into a field, or any other attribute.
  • Scroll depth: the furthest point reached, in percent of the page's height.

Clicks are sent together, 5 seconds after the first or as soon as 20 are waiting, and the scroll depth goes when the tab is hidden or closed. The same visits are skipped as by the Viakite script (automated browsers, Exclude my visits, localhost unless data-localhost), and Do Not Track is respected when the project turns it on. Clicks and scroll depths are kept apart from your events: they don't count as events in reports.

The page's address is cleaned the same way as for page views: only the allowed query parameters stay.

Read a heatmap

Open Analytics → Heatmaps. Pick a page under Page (your 100 most viewed pages with heatmap data, most viewed first) and a width: Desktop (a window 1,024 pixels wide or more), Tablet (768 to 1,023) or Mobile (under 768). The page, the width and the date range are kept in the address, so a link opens the same view.

PartShows
TotalsPage views the heatmap script measured, clicks, clicks per page view, and the average scroll depth
ClicksWhere the page was clicked, on a blank frame as wide as the device, in five shades from fewer to more clicks; a ruler every 1,000 pixels down the page. Hover a spot for its clicks
Scroll depthFor every 10% of the page, the share of page views that scrolled at least that far
Most clickedThe 20 most clicked elements, by their selector

The click map shows the clicks, not a picture of your page: the spots sit where they were on the visitors' pages, by share of the width and pixels from the top, so compare them with your page open at the same width. Clicks are counted in a grid of 50 columns and 20-pixel rows, down to 12,000 pixels; clicks further down are left out. Filters and segments don't apply to heatmaps; the date range does.

In the API

GET/v1/projects/{project}/analytics/heatmaps/pages GET/v1/projects/{project}/analytics/heatmaps/clicks GET/v1/projects/{project}/analytics/heatmaps/scroll

Next steps