Passing page ID from LP to TY page, through HubSpot form
SOLVE
One of our clients is looking to utilise a single thank you page for all of their landing pages.
The motivation behind this is to save time and reduce complexity for marketers, and to reduce likelihood of inconsistency. So a marketer creates a LP for an offer, tags with necessary categories / business areas / content types (we have developed a tagging custom module using HubDB for this), but then they do not need to create a thank you page.
The ideal idea is that the TY page is passed the ID of the referring LP. However, at the very least the post data would give me something to look up the referring page via the API. From there, the TY page would grab relevant related content etc.
**FYI - the form MUST be a HubSpot form. The landing pages already have a Form module and replacing with custom HTML forms is not an option. **
According tothis pagethe following variable should contain the POST data:
{{ request.post_dict }}
However, all it contains is the submission GUID. Seeing as there is no form submissions API, I have nothing to look up to try to grab related content etc.
Changing the forms to embed code isn't really an option. It means the guys editing/creating the pages don't get to simply choose a form, add different options ie workflows / campaigns. Plus they'd need to add the callback themselves or we'd have to create modules for every form with the callback already included.
However, I guess I could use the callback separately and not within the embed code, and use localStorage (totally overlooked this option, so thanks for that!).
Passing page ID from LP to TY page, through HubSpot form
SOLVE
Hi @Craig - I totally understand why you would want to keep the form module instead of embed code. Here's some examples of using the formsubmit outside the scope of the embed code.
Passing page ID from LP to TY page, through HubSpot form
SOLVE
thanks @tjoyce I've used the global events before - my only concern was that as they are non-blocking, can it be guaranteed that the localStorage var gets set before the page redirects?
Passing page ID from LP to TY page, through HubSpot form
SOLVE
Ah, good question.
Perhaps, you could change your form to not redirect, and instead to a thank you message. And have your js function handle the redirect to the thank you page?
Passing page ID from LP to TY page, through HubSpot form
SOLVE
Actually that's a good idea @tjoyce as they will all be going to the same URL anyway. In fact doing it this way I could send a querystring if I wanted instead.