Track form submissions

  1. Site requirements
  2. Data validation
  3. Restrictions
  4. Questions and answers
Note. The goal is created automatically if the Automatic goals option is enabled in the tag settings.You can manage this goal just like other automatic goals.

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.

To do this, you need to set a special goal in Yandex Metrica. You can create this kind of goal:
  • For all forms on your site.

  • For a specific form. Use this method, for example, to track different forms.

To create a goal manually:
  1. In Yandex Metrica, go to the Goals page in the left menu.
  2. Click Add goal.
  3. In the Name field, enter a name for the goal to create.
  4. Select the Form submission goal type.
  5. 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.
  6. 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.
  7. Check whether the goal is working correctly.

Goal completion is registered when a user clicks the form submission button. To view goal statistics, use the Conversions report and add the goal to other Yandex Metrica reports.

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.

Site requirements

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.

If the form is processed using JavaScript, the goal will only work for the standard event onSubmit.

Data validation

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.

For click or submit events not to be counted in goal achievement and only sending the form to be counted:
  • 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.
Tip. If you do not have the ability to reconfigure the work of HTML elements on the site, use the JavaScript event goal.

Restrictions

  • 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

How do I add a goal to a form that is in an iframe?
If the form is in an iframe, configure the tag in the code of this iframe. When creating the goal, you need to specify the iframe address in the form address field.
The tag is installed on the page with the form, but no goal is created. Why?

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).

Why is the goal triggered if the form has not been submitted?

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.

Are statistics collected if the same form is used on several pages?

If a form with the same ID is used on different pages, then the created goal will work on all pages.

How do I select a form hidden under a button?

To select a form hidden under a button, click the button first.

Will the form work without Session Replay?

If Session Replay is not enabled in the tag settings, the goal can work without it.

Will the goal for the previous version's code snippet work?

The goal may work for the previous version of the code snippet.

Does the form work if the “Replace https with http” filter is set?

If in the tag settings on the tab Filters the operation Replace https with http is enabled, the form selection mode does not work.

Does the form work with redirects?
If the page where you want to select a form redirects to another one, then form selection is not available. You can create a goal for tracking all forms or use the JavaScript event goalto track the submission of a specific form.

Select a question to find a solution.

Goals in Yandex Metrica work the same way for any source. Perhaps there aren't any users who have completed the goal from this source yet.


This might happen for the following reasons:
  • The goal condition in Yandex Metrica doesn't cover all the possibilities. For example, the goal is set as going to the order confirmation page, but the site also allows instant checkout without visiting this page.
  • The site user has a browser plugin that blocks the Yandex Metrica tag, so this user isn't counted.
  • The user has an antivirus system with strict privacy settings.
  • The user has a slow internet connection, so the Yandex Metrica tag didn't load on the target page.