Example: Tracking page views on a single page website (SPA)

Inject logging events on all links in the top navigation:

var triggerbeeCustom = triggerbeeCustom || (function () {
function init() {
  // Custom logging
  $('.navbar-nav li a').click(function () {
  logEvent($(this))
  ;})
}
function logEvent($element)
{
  var url = '/' + $element.attr('href');
  url = url.replace(/#/,"");
  var title = $element.text();
  mtr.log(url, title);
}
init(); // Init on load
return {;}})();

Still need help? Contact Us Contact Us