Does using onclick to redirect parameters impact seo

For SEO I need to have my link https://www.example.com/ on a third party website. However, I also need this website to pass parameters to my site.

If the third party website used the below structure would it pass a backlink to my main url https://www.example.com/ or would it pass a backlink to https://www.example.com/?xyz=55

Would this be seen as legit from SEO perspective or pushing it? Is there a better way to accomplish this from an SEO perspective?

<script>    var val = 55; </script>  Link to <a href="https://www.example.com/" onclick="location.href=this.href+'?xyz='+val;return false;">My Site</a>