Add some JS code to initialize state