Projet

Général

Profil

Paste
Télécharger (995 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / matomo / matomo.js @ 60283730

1
(function ($) {
2

    
3
$(document).ready(function() {
4

    
5
  // Attach mousedown, keyup, touchstart events to document only and catch
6
  // clicks on all elements.
7
  $(document.body).bind("mousedown keyup touchstart", function(event) {
8

    
9
    // Catch the closest surrounding link of a clicked element.
10
    $(event.target).closest("a,area").each(function() {
11

    
12
      if (Drupal.settings.matomo.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) {
13
        // Mailto link clicked.
14
        _paq.push(["trackEvent", "Mails", "Click", this.href.substring(7)]);
15
      }
16

    
17
    });
18
  });
19

    
20
  // Colorbox: This event triggers when the transition has completed and the
21
  // newly loaded content has been revealed.
22
  if (Drupal.settings.matomo.trackColorbox) {
23
    $(document).bind("cbox_complete", function () {
24
      var href = $.colorbox.element().attr("href");
25
      if (href) {
26
        _paq.push(["setCustomUrl", href]);
27
        _paq.push(["trackPageView"]);
28
      }
29
    });
30
  }
31

    
32
});
33

    
34
})(jQuery);