APIs & Integrations

KHarlin
Member

Callback in CTA popup

I have a project, where we are tracking formsubmissions in 3. party tracking. We get a callback with the formID when submitted, great. But on forms in popups, I dont get the submitted values like I do on embedded forms.
Are there any way to get the submitted data in the callback when form is in a CTA popup? Seems like it should be, when the form is the same regardless if it's an embed or a popup.

5 Replies 5
GRajput
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Callback in CTA popup

Hi @KHarlin 

You're right, ideally, the submitted data should be available in the callback regardless of the form placement (embedded or popup). However, HubSpot's current functionality has limitations for popups.
Here's what you can do:

1. HubSpot offers global form events that fire at different stages of the form submission process. While the deprecated onFormSubmit isn't ideal (it fires before data is sent), you can leverage the newer onBeforeFormSubmit event. This event triggers before submission but after validation, allowing you to access the form element and potentially extract data using Javascript.

2. Here's a resource on using Global Form Events:

https://legacydocs.hubspot.com/global-form-events

 

 

"I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!"




Gaurav Rajput
Director, MarTech( Growth Natives)

Book a meeting


0 Upvotes
KHarlin
Member

Callback in CTA popup

Hi Guarav,

The global form events are not called on the form.
 I made a test, where I logged all events called in the process:

  1. onCallToActionReady
  2. onCallToActionViewed
  3. onCallToActionFormSubmitted

So it seems the like only way to do it, is to add my own eventlistener on the form tag, checking for submits. Storing the data and wait for the onCallToActionFormSubmitted event, and then use the stored data.

I was just hoping for a better solution, since I am happy with the way normal forms are working.

0 Upvotes
KHarlin
Member

Callback in CTA popup

Nope, dug deeper. The form is of course in an iframe. So I can't add eventListener on the form inside og the frame.

I think it might not be possible.

0 Upvotes
KHarlin
Member

Callback in CTA popup

Hi @BérangèreL 

 

Thanks for reaching out 🙂

 

1. It's a HubSpot form

2. It's on an external site (WordPress)

3. I just push the info to GTM datalayer, from there others take over

 

The problem is that I only get the formID and id in the callback, not submitted values. If I insert the same form directly on the page, i get submitted values in the callback.

 

For the form in popup, I get a callback with eventname: onCallToActionFormSubmitted without submitted values

 

For directly embedded forms in the content, I get a callback with eventname: onFormSubmitted with submissionValues.

 

I would expect to get the same for both callbacks 🙂

 

Best Regards

Ken

0 Upvotes
BérangèreL
Community Manager
Community Manager

Callback in CTA popup

Hi @KHarlin,

Thank you for asking the Community!

I'd like to ask clarifying questions to better understand, please:

1. If the popup form a HubSpot form? Or an external form?
2. Where is the popup added, on an external page? On a HubSpot page?
3. How do you track the form submission? Which third-party app is it?

The more info, screenshots (without sensitive/confidential information), and details you can provide, the better the Community can assist.


I'd be happy to put you in touch with some of our Top Experts: Hi @MBERARD, @zach_threadint and @Anton do you have suggestions to help @KHarlin, please?

Thanks a lot and have a great day!

Best,
Bérangère


Saviez-vous que la Communauté est disponible en Français ?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings!