Fix analytics check to run only when there is an order. Fixes #4929