Thanks for your response Alen. I do use GA and I agree this is what I would use if it was my site. But this is actually for a client and they are requesting it this way.
The call to action is a link to a contact form page. The client wants a variable containing either the URL or some other unique page identifier passed into a hidden form field on the page.
When this get submitted, it goes into their CRM. They want to be able to see all the data in one place which I guess is why they don’t want to use GA.
I had this working using Gravity Forms and I was just inserting the page url as a parameter into the link via PHP. Gravity Forms has a built-in feature that allows populating a form field’s value with a parameter sent in the URL.
But the client didn’t want to use Gravity Forms. So now I need to figure out how to do it without it.