I ran in to a situation at work today where an advertiser, wanting to place a tracking pixel on a sponsored piece of Web content, only wanting to know about visitors who have been on the page containing the content for at least one minute. The advertising system we use doesn’t offer a solution for this out of the box and I didn’t think it would be terribly difficult to make happen, but was surprised to not find any quick how-to guides anywhere.
The code snippet below outputs markup to a visitors browser 60 seconds after the page they are viewing loads. It was tested in Doubleclick’s Dart for Publishers as a piece of custom creative targeted to a ad zone used exclusively by the piece of sponsored content:
<script languagage="Javascript">
/* %u - keep Dart from complaining about no url */
setTimeout("firePixels()", 60000); //60 second delay
function firePixels(){
var tStage = document.getElementById('trackerstage');
if (tStage){
tStage.innerHTML = "<img src=\"http://www.100781.org/happles.jpg\">";
}
}
</script>
<div id="trackerstage"></div>
This solution worked perfectly, after replacing my test image with the advertiser’s tracking pixel, of course. This is also simple enough that it should be able to work just as well when delivered by any advertising system. Have a similar solution or tip? Share!













