Track link clicks

sendinblue.trackLink() is used to track click events on various links of your website.

We have inserted a small timeout so that there is enough time to log the event, otherwise, the page would change before the method is called.

    link, /*mandatory*/
    properties /*optional*/
  • link is the DOM element that you want to track
  • properties is a JSON object where you can pass any properties that describe the context of the click (ex. page title) or your visitor's state (ex. first name, last name, age, etc.)


Implement trackLink() after the tag

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

Let's say you want to target all of your users who have downloaded the pdf file for the case study A. If link is the DOM element you want to track clicks on, then your code would look like:

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

var properties = {
  'casestudy': 'A'

sendinblue.trackLink(link, properties);