I have some code which calls a function like this :
function trackPDFSEClicks(){
ahoy.track("Viewed Job Spec", {title: "Viewed Software Engineer Job Spec"});
window.location.href = "/Software Engineer.pdf";
}
However because this track call is asynchronous - sometimes it doesn't complete before the PDF has loaded - and therefore the event is not tracked.
I do not necessarily want to have to go and handle this tracking in the controller as it would be far simpler for me to use this method if possible - so is there any way I can force this ahoy.track call to be run synchronously?