New player. What determines when level up's give Gold/Health instead of Item Upgrades?

Hi all, got this game recently and have been really enjoying it! I have been consistently been able to reach the 30 minute mark on quite a few of the maps. However, I was wondering what determines when your level up's give health/gold instead of further item upgrades? Thanks!