I'd put this higher in the the theme file, to be honest, like header.php.  Or change this line to:

```
window.hacks = window.hacks || {};
```