To track so called "virtual pageviews", use the ga('send')
method right after your asynchronous request:
Syntax: ga('send', 'pageview', 'path to your virtual page');
Example (Simple Link):
<a href="http://example.com/my.pdf"
onClick="ga('send', 'pageview', '/virtual/my.pdf');">Download PDF</a>
Example (JQuery AJAX):
$.ajax({
url: '/ajax-url/file.json',
data: {page: 4},
success: function(data) {
ga('send', 'pageview', '/ajax-url/file.json');
console.log("Got response",data);
},
dataType: 'json',
method: 'GET'
});
Sources: