I need help with the following link:
<a href='external-url' class='track' data-type='event' data-category='category'>
Link
</a>
Whenever the link is clicked, a specific function is triggered:
$('a.track').on('click', function(e){
e.preventDefault();
var type = $(this).data("type");
var category = $(this).data("category");
track(type, category);
window.location = $(this).attr("href");
});
The track function sends data via ajax and stores it in a database. It works perfectly on desktop browsers and Android devices.
However, I'm encountering an issue on iPhone where the link doesn't always add the data to the database when clicked. It seems to fail around 10 times, then start working for another 10 times randomly. Can anyone help identify what might be causing this issue? It could be related to my code or something specific to iOS that I have missed.