MenuClicks

Track

Clicks

Send a Click event for buttons and links that are not goals, as a selector and a text length, so Lens mode can show what visitors clicked.

Add data-clicks="true" to the script tag and ProductLense records a Click event when a visitor clicks a button or a link that is not a goal. Lens mode uses it to light up the same element when you walk a visit, and to count clicks on it for everyone.

HTML
<script defer data-site="SITE_ID" data-clicks="true" src="https://api.productlense.app/a.js"></script>

What is sent

Each click sends one Click event with two props: s, a short selector that finds the element again, and t, the length of its text. The words themselves are never sent, so a button's label, a search box or a link's text cannot reach ProductLense.

PropExampleMeaning
smain>nav>a:nth-of-type(3)The element's id when it has one (div#cta>button), else up to four tag steps from its nearest ancestor, at most 120 characters.
t12How many characters the element's text has.

Clicks are reported for button, a[href], elements with role="button" and submit inputs. A click on an element with data-pl-goal sends that goal's event instead, as it does today. Outbound links and downloads keep sending their own events too.

Leave an element out

Add data-pl-ignore-click to any element (or an ancestor) and clicks on it are not reported.

HTML
<button data-pl-ignore-click>Delete account</button>

Cost

The clicks code is a separate 0.5 KB file, c.js, that the script loads only when data-clicks is on. Every Click event counts toward your plan's monthly events like any custom event: on a site where visitors click a lot, check usage after turning it on.

Where it shows

The Events page lists Click events with their props. Lens mode draws them: on a walk, the element flashes when the visitor clicked it; in the page lens, each clicked element carries a badge with its clicks and the share of visitors who clicked. Use goals for the clicks that matter to revenue, and clicks for everything else.

    ↑ ↓ to move, Enter to open