I'm trying to integrate a custom code into a form I made but can't seem to find out where to add the code. The code needs to be linked to a hidden form field to capture a unique shortcode from the URL and campaign ID associated with the URL.
I know this is possible because I have heard of people doing this on Hubspot but can't seem to figure out how.
That is right. You can add the code in your form embed code which you can copy it after clicking the 'Share' button and for this I'd love to share with you this documentation here: Share a HubSpot form on an external site.