Tracking ajax access


(Michel Michaels) #1

Hi,

in our individual Joomla / VirtueMart solution the page is updated using ajax access.
Question: How to enable Matomo to collect data for such access resp. how to “formulate” the ajax access ?

Thanks a lot in advance,

Michel


(Fabian Dellwing) #2

You can write your own ajaxSuccess handler and pushing the page to Matomo this way:

$(document).ajaxSuccess(function(event, xhr, settings) {
  _paq.push(['setCustomUrl', '/' + settings.url]);
  _paq.push(['setDocumentTitle', 'My New Title']);
  _paq.push(['trackPageView']);
});

See: How to track single-page websites and web applications using Piwik Analytics - Analytics Platform - Matomo and .ajaxSuccess() | jQuery API Documentation