The code putting ads on webpages can stop pages loading by seconds, finds analysis of millions of sites.