I have this tracking function:
function trackMe(link, myID) {
var trackPath = "http://www.theurl.com" + myID + "&size=1x1";
var img = $('<img>');
img.attr('src', trackPath);
img.appendTo('div.promo');
}
Which is fired from an href as so:
<a href="http://www.togolink.com" onclick="trackMe(this, 'SpecialCode1');">Buy</a>
In Charles proxy, I receive the following error when I click on the href:
Client closed connection before receiving entire response
And the tracking pixel is not sent/received properly.
Any idea what would be causing this?
make the
href="#"because this is being directed tohttp://www.togolink.comon clickAlso i think there should be a somemore thing between the link and myID something like
Most important thing is, since you are already using
jquerywhy are you usinginlinejavascriptwhy notjquery click event handler.HTML:
jquery:
EXAMPLE