I display video ads to my users. I don\'t host these ads by the way; I get them from another company.
When ever an ad is clicked it leaves a cookie in the user\'s b
When you call setInterval, it returns you an interval ID that you can then use to stop it by calling clearInterval. As such, you'll want to count the iterations in a variable, and once they've reached a certain count, use clearInterval with the ID provided by setInterval.
var iterations = 0;
var interval = setInterval(foo, 10000);
function foo() {
iterations++;
if (iterations >= 5)
clearInterval(interval);
}
Live example