The Munchkin function calls (including init(), wihich calls visitWebPage() internally) do not fire callbacks when they are complete. Since they involve doing a remote GET of a tracking pixel, naturally they won't be complete before your immediate call to deleteCookie(). (Not to mention that JS is single-threaded, so they can't even start to run until after your code block is done executing.)
If you can't even wait for the document to load before trashing the cookies (window.onBeforeUnload), then yes, you'd have to poll for cookie changes every second.
You could actually do all the tracking within an IFRAME, which would allow the window to close itself (and thus run its own cleanup code on onBeforeUnload). However, if you're not an experienced JS dev this is probably too rough a road.