On certain pages of my website I use URL parameters on links:
<a href="/example/?parameter=value">Click here</a>
The target URL is always exactly the same (i.e. /example/). With exactly the same content.
The URL parameter only serves the purpose of being used as a hidden form field in a form on that page. So that I can identify the page the user has visited before actually submitting that form.
My question: How do I correctly set the canonical to prevent the target page to be indexed multiple times?
Only on the actual target page in the head like this?
<link rel="canonical" href="https://www.example.com/example/" />
Or should I also do it on the actual original link? How would I ideally solve this?
Currently, the tool ahrefs.com claims those pages as "Duplicate pages without canonical" although I have already set the self-referencing canonical on the target page like this
<link rel="canonical" href="https://www.example.com/example/" />.