Lead Capture Tools

johdah
Participant

Send events to Google Analytics from inline form

SOLVE

Is there a way to send events to Google Analytics after submission of an inline form on HubSpot?

On an external page, using the Javascript-snippet, there is the possibility to run whatever javascript you need, but when adding a form on the HubSpot platform, I see no option to send events or add custom code anywhere. Am I missing something or is this not possible?

2 Accepted solutions
jennysowyrda
Solution
Community Manager
Community Manager

Send events to Google Analytics from inline form

SOLVE

Hi @johdah,

 

Have you seen this resource? Let me know if that resolves the issue.

 

Thanks,
Jenny

View solution in original post

johdah
Solution
Participant

Send events to Google Analytics from inline form

SOLVE

No I hadn't. Thanks for pointing me in the right direction!

For anyone else reading this, I'm posting the correct (in my case) answer here.
You can use the hsvalidatedsubmit event that fires after the form is validated.

 

In my case, I did this:

  $('body').on('hsvalidatedsubmit', '.hs-form', function (e) {
    ga('send', {
      hitType: 'X',
      eventCategory: 'Y',
      eventAction: 'Z',
    });
  });
  

 

View solution in original post

3 Replies 3
jennysowyrda
Solution
Community Manager
Community Manager

Send events to Google Analytics from inline form

SOLVE

Hi @johdah,

 

Have you seen this resource? Let me know if that resolves the issue.

 

Thanks,
Jenny

johdah
Solution
Participant

Send events to Google Analytics from inline form

SOLVE

No I hadn't. Thanks for pointing me in the right direction!

For anyone else reading this, I'm posting the correct (in my case) answer here.
You can use the hsvalidatedsubmit event that fires after the form is validated.

 

In my case, I did this:

  $('body').on('hsvalidatedsubmit', '.hs-form', function (e) {
    ga('send', {
      hitType: 'X',
      eventCategory: 'Y',
      eventAction: 'Z',
    });
  });
  

 

Petya
Participant

Send events to Google Analytics from inline form

SOLVE

Hi @johdah ,

 

Did you add this to the form embed code?

 

Best Regards,

 

Petya

0 Upvotes