How do royalties work for free to play UE4 HTML5 games on ad-supported websites?

If the ads are not in or directly connected to the game, then there is no royalty on that revenue.