How do I handle milestones for levels?

I understand the concept behind milestones, and what the DMG recommends. I was planning to use old fashioned XP-per-encounter for my campaign, but the more I read the more I prefer milestones.

My question is, how do I handle milestones in a sandbox setting? In a more linear story it is easier, as I have set points of the plot where the characters can level up. In a sandbox, however, players can ignore the main story line in favour of the smaller quests and villains, each of which is insignificant in the grand scheme of things. How do I handle milestones in this case?

An example to clarify

I would like to run a campaign where something big is happening in the world (e.g. gods are about to go to war, or 2 different nations). The PCs will be in that world and could possibly be involved in this overarching “incident”. I, as DM, could throw something their way to incentivise them to get involved (e.g. they find something one of the sides is looking for), but they would be free to ignore it or follow their own backstories (while the overarching “incident” is moving along) and they can get involved later.