Wierd site output [closed]

This looks like a hack, probably in W3TC.

Try disabling all the Plugins one by one, and if it doesn’t go away, try switching to the default theme.

If that did not work, install WordPress from scratch, and transfer the database to it.

If you prefer another debug mode, I suppose your script gets hooked into WordPress in the wp_footer action. To verify that, you could comment the line wp_footer(); out, probably in footer.php.
It should be gone with that.

To find out what injected it, try out @rarst R Debug, which helps you see what action get performed where.

Good luck!