Automatic UTM parameter for tracking page clicks internally?

I have 5 pages that each have a ‘register’ button.

I have a ‘register’ page with a form and a hidden field of ‘source’

I currently have to open an external url and hardcode the link with "https://mysite/register?source=page’ to a hidden field on the form, to track where a registration comes from.

But I want to open that registration page in a modal.
Is there a way I can achieve the same logic of tracking where the registration came from?