Urgent.News

What's breaking now, across thousands of outlets.

Tech

127 vues et 0 clic — le tableau de bord le plus utile que j'aie construit

J'ai écrit mon propre tracker de clics pour une raison simple : je voulais savoir si les visiteurs d'une page cliquaient sur le lien qu'elle contenait. Pas combien de temps ils restaient, pas d'où ils venaient, pas leur empreinte de navigateur. Une question, deux chiffres. Le premier rapport a répondu : 127 vues, 0 clic . Ma première réaction a été de chercher le bug. Ma seconde, plus utile, a…

The author created a custom click-tracking system to determine if visitors were clicking on links within a page. The tracker, which consists of a single PHP file and an SQLite database, logs two types of events: page views and clicks. It records the page URL, the type of event (view or click), the target URL, a reference URL, and a truncated hash of the user's browser agent.

The tracker is invoked with two GET parameters: `p` for the page URL and `e` for the event type. The page sends requests to the tracker using the `fetch` function, and the tracker listens for click events on anchor tags with a `data-track` attribute. The author discovered a bug in the tracker, which caused click events to be missed when the click was triggered by a button with an `onclick` event and no `href` attribute.

After fixing the HTML, the tracker correctly logged a zero click count, which accurately reflected the fact that the page had no clickable elements. The author emphasizes the importance of honesty in data tracking, as a zero value can provide valuable insights and prevent false conclusions about the page's performance.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How to put a video on a landing page without hurting page speed

A product video is usually the heaviest thing on a landing page, and the easiest to get wrong. Here is the setup I use so the video helps conversion without costing page speed.

  • Host video externally on YouTube or Vimeo to avoid page speed impact.
  • Display thumbnail, load player on click to reduce initial load time.
  • Use iframe with autoplay, encrypted-media, and picture-in-picture settings.

More from Saturday 14 November →