simpleanalytics / roadmap

File you bugs and feature requests here
23 stars 2 forks source link

Auto events ignore specific links #699

Open simpleanalyticsbot opened 1 year ago

simpleanalyticsbot commented 1 year ago

I like the auto events script, however it would be nice to be able to exclude specific outbound links.

A solution could be adding a data- atrribute, for example data-sa-nocapture. In the loop you could check for that.

<a href="https://example.com" data-sa-event-ignore>bla</a>
// Loop over all links on the page
      for (var i = 0; i < a.length; i++) {
        var link = a[i];
        var href = link.getAttribute("href");

        // Skips links with data-sa-event-ignore data attribute
        if(link.dataset.saEventIgnore != null) continue;