Track form submissions
If your site has a feedback form, you can use Yandex Metrica to track the number of times that users submit it. Depending on how the form is implemented, you can track both the click on the button and the form submission.
For all forms on your site.
For a specific form. Use this method, for example, to track different forms.
- In Yandex Metrica, go to the Goals page in the left menu.
- Click Add goal.
- In the Name field, enter a name for the goal to create.
- Select the Form submission goal type.
- Select which forms to create a goal for. If you chose Specific form, enter the webpage where the form is placed in the field and click Go and select a form. In the window that opens, Yandex Metrica highlights the forms that were found on the page. Select the one you need.Note. Yandex Metrica only highlights the forms on the webpages that users visited in the past 30 days. You can select one of these forms.
- Click Add goal. The created goal will appear in the list of goals. Yandex Metrica will start collecting statistics on it within a few minutes.
- Check whether the goal is working correctly.
The form is identified by the presence on the site of the form element and some form parameters: id, name, or the DOM element path. When you add a goal, Yandex Metrica displays the parameter that was recognized. It indicates which form the goal was created for — you may find it convenient to distinguish Yandex Metrica goals in the list of goals. When checking the achievement of goals, it does not take into account which page this form was selected on.
When creating a goal, it is important to consider:
- The form must be created using the tag form. If a form is made with div tags, it will not be tracked.
- Form submission must be via the elements button type="submit", input type="submit". If sending is implemented via the element button type="button", no goal is achieved.
- The button type="submit" and input type="submit" elements must be located inside the form element.
By default, the goal is considered achieved not only when the form is successfully submitted, but also when an unsuccessful attempt is made to send it, for example, when the data from the form has not passed validation.
- Add the attribute disabled to the button code before data validation.
- Use CSS to make the button inactive. In this case, the event click may be counted, for example, if the scripts were checked on the site before the button was deactivated.
- This type of goal can't be used in Multi-step goals.
- The service registers a user that completes the same goal on the same tag no more than once per second.
- During a single user session, the service can register up to 400 completions of all the goals created for a tag.
- If you edit a tag or goal, previously collected information doesn't change.
- If you delete a goal, information collected for it, is no longer available in reports.
Questions and answers
You can set a goal for forms with pages that have had traffic in the last 30 days. Make sure that the traffic to the page with the form is recorded by your tag (check the filters, address settings, and so on).
If the form has a function to check the validity of its filling, the goal will be registered as being achieved even when someone tries to send an invalid form. In this case, we recommend looking at the converted sessions for this goal.
If a form with the same ID is used on different pages, then the created goal will work on all pages.
To select a form hidden under a button, click the button first.
If Session Replay is not enabled in the tag settings, the goal can work without it.
The goal may work for the previous version of the code snippet.
If in the tag settings on the tab Filters the operation Replace https with http is enabled, the form selection mode does not work.