Tracking form only when it's visible


#1

Hi,

On our website we display a form with a click on a button. We are doing this with the css property display: none; and display:block;
The problem is that hubspot is tracking it as formview everytime someone visits our page, because the form is there it is just not visible until the user clicks on the button.

I tried creating the form when the button is clicked, but the form is not being created.

Does someone have a solution to this problem?

Thank you in advance


#2

Hi @Michael_Gassner,

The form view tracking occurs when the form embed code is loaded, not necessarily when the form is displayed in a way that’s visible to visitors. It sounds like you’ve tried waiting to load the form until after the button has been clicked? How did you do that?


#3

Hi

First of all thanks for your reply and sorry for the late answer.

The simpliest way i thought of, I just inserted the normal form code in the onclick function

This code:

Or maybe can i somehow block the tracking and after the button is clicked it initialises the tracking?


#4

Hi @Michael_Gassner,

Putting the code into the onclick callback should do the trick.


#5

Stupid mistake on my part, the form has been created, but i didn’t specified a target, so it was on the bottom of the page and not inide the div.

Anyway thanks for your help