I just did something similar, but just for tracking the source URL for our team to know where the form was submitted from. I added a new hidden field named url_query_string and added this script to the page:
<script>
setTimeout(function(){
// Modify hidden field to pass through the query string into Hubspot
var addQueryToField = document.querySelector(".hs_url_query_string input");
addQueryToField.setAttribute("value", window.location.search);
}, 600);
</script>