Parse URL to get a parameter

What kind of error do you get? Do you try this in preview mode or published mode? I believe you should test it in published mode and also do a console.log(query); so you can inspect that.