APIs & Integrations

Jeromecollomb1
Member

Adding delay after form submission

Hi guys,

My hubspot form redirects to a hubspot landing page that displays elements based on information entered in the form.

Specifically, the form asks for "industry". The landing page then displays a specific image as background, based on the industry entered. I did this using a workflow that sets an image as property (based on info entered in the form) and then built the template of my landing page with the following code :

background-image: url('{{contact.industry_image_background}}');

It works fine, but the problem is that it doesn't work fast enough.
When people submit the form and get redirected, the image is not loaded. I have to refresh the page one or two times and then it gets displayed.

I need to make this work. How can I make a workflow work faster?
Any workaround?

Thanks,

3 Replies 3
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Adding delay after form submission

Hi @Jeromecollomb,

In general, personalization tokens will only populate for known contacts when used on thank you page. The redirect will always happen faster than the contact creation process, so it's not possible to include traditional personalization parameters on thank you pages. As a workaround, you could append the values you care about to the redirect URL, and then change your personalization tokens to pull values from the URL query parameters.

The following topic has some more info on this:

0 Upvotes
Jeromecollomb1
Member

Adding delay after form submission

Thanks @Derek_Gervais,

I put the following code that adds a 5000 ms delay after submitting the form which gives time for Hubspot to create the contact and process the form field values, so the landing page can display the right information!

<script>
jQuery.getScript("//js.hsforms.net/forms/v2.js", function() {
    hbspt.forms.create({
        portalId: "XXX",
        formId: "XXX",
        onFormSubmit: function($form) {
            setTimeout(function() {
                window.location = "YOUR URL HERE";
            }, 5000);
        }
    });
});

Thanks!

0 Upvotes
smithjl
Participant

Adding delay after form submission

@Jeromecollomb1 where did you add this script? 

0 Upvotes