Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript link tracking script + Safari
    primarykey
    data
    text
    <p>I'm trying to make a link tracking script. It should work like Google Analytics only it should make posts to our own server. I'm using jQuery for this. The code i have written so far is the following:</p> <pre><code>jQuery(document).ready(function() { var opts; jQuery.fn.trackAllLinks = function(settings) { settings = jQuery.extend({}, jQuery.fn.trackAllLinks.defaults, settings); opts = settings; function track() { href = jQuery(this).attr('href'); var trackImage = new Image(1, 1); trackImage.src = opts.linkredirector + '?eurl=' + jQuery.URLEncode(href) + '&amp;rnd=' + new Date().getTime() + '&amp;title=trackerimage.gif'; trackImage.onload = function() { trackImage.onload = null; doNothing(); } delay(300); return true; }; function delay(mseconds) { var currentTime = new Date(); var endTime = currentTime.getTime() + mseconds; while (currentTime.getTime() &lt; endTime) { currentTime = new Date(); } } function doNothing() { } if(jQuery(this).is("a")) { jQuery(this).click(track); } jQuery(this).find("a").click(track); }; jQuery.fn.trackAllLinks.defaults = { linkredirector : '__url_to_post_on__' }; }); </code></pre> <p>It works fine in all browsers except Safari. When i'm using a mailto link or an anchor it works but when i'm linking to another page it doesn't work. I have been testing a lot of different implementations and i can't get it to work. Any of you have an idea what i'm missing? I have tried to understand how Google Analytics works and as far as i can see it does the same. When i use WireShark to monitor my network i see that the image of Google is being requested but that my image isn't.</p> <p>greets, Daan</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload