A few line number changes.
Do not use statichost with assets retrieved via ajax.

Violates same origin.
Only cancel if the outstanding one is pending.
Analytics snipped should be in the html they say.