Append Hubspot form's data-instance-id to cloudfront link on redirect page

I’m working on a project where we’re using a Hubspot form embedded on the intro page in Wordpress. Once the form is completed, it redirects to another Wordpress page with an iframe that uses a Cloudfront URL. What we’d like to do is append Hubspot’s unique data-instance-id from the form to the second page’s URL. I imagine there is a script out there that might do this.

Does anyone have experience with this?

Hi, @sweetweaver :waving_hand: Thanks for reaching out! Hey @ChehakWadhdwa, do you have any experience here?

Thank you! — Jaycee

Hey @sweetweaver

window.addEventListener(“message”, function(event){

if(event.data.type === ‘hsFormCallback’ && event.data.eventName === ‘onFormReady’) {

var $form = $(‘form[data-form-id="’ + event.data.id + ‘"]’);

var $firstName = $form.find(‘name=[“first_name”]’);

$firstName.val(linkedInAutofill.first_name);

}

});

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.

This is exactly what we needed. Thank you so much!