Track link clicks

📘

Legacy Tracker Documentation

For the legacy tracker doc, check our guide here.

trackLink() is the function used to track clicks on links on your website. You can use it like this:

Brevo.push([
  "trackLink",
      link,      /* mandatory */
      properties /* optional */
]);

Parameters are defined below:

AttributeDatatypeDescriptionValue
linkDOM elementIt is the DOM element that you want to trackdocument.getElementById('download_casestudy_a');
propertiesJSON objectDescribes the click context or the visitor’s state{ “title”: “Page title”}

📘

Implement trackLink after the tag

trackLink() needs you to pass the DOM elements which should have been loaded before. Therefore it's better to implement trackLink() after the <body> tag while making sure that your DOM elements are already loaded.

Example:

var link = document.getElementById('download_casestudy_a');

var properties = {'casestudy' : 'A'}

Brevo.push([
  "trackLink",
      link,      /* mandatory */
      properties /* optional */
]);

What’s Next