Does using onclick to redirect parameters impact seo

For SEO I need to have my link 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 or would it pass a backlink to

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="" onclick="location.href=this.href+'?xyz='+val;return false;">My Site</a>