Use events to set up goals
The simplest way to track conversion for a contact form on a web page is using thank you page with a real physical URL which appears after successful form submission – something like example.com/contact-thank-you. But how do track such a web form when we can’t implement such a page and User? After submitting the form is just getting a notification such as:
After hitting Submit (with all fields correctly filled up) page is not reloading and this notification is appearing in place of the form itself.
In this case, we can’t create a Goal based on URL because visiting URL of the form is not completing a goal, it is just viewing the form. To resolve this matter we can use either Virtual Pageview and the Events. We are going to use Event and fire up the specific configuration of the Event when the form is submitted.
Event is an action which can be fired under specific conditions or in a specific place to record some behavior of the User. We need to define at least 2 elements:
In this example we are going to use Category, Action and Name to accurately define our contact form:
- Category = Form
- Action = Submit
- Name = Contact
To proceed with the implementation we need to get through following steps:
1. Create a tag based on Piwik PRO Custom Event template:
2. Set up the event with Category, Action, and Name by just pasting the values mentioned earlier:
3. Create a trigger which will allow the tag to fire in the desired moment. To do that we need to choose the right type of the Trigger (Form Submission) and localize our form by URL:
4. After saving and publishing all changes we can go to Debug mode and check if our tag is correctly firing up. Let’s fill out the form, find our new tag on the list to the right and click Submit. We should be able to see something like this during submission:
5. Now we can also check Events report in Analytics (new) to see if Piwik correctly records those events. Go to Reports > Behavior > Custom Events
6. Now we can configure our goal using Contact as Event Name:
7. And add funnel with form URL to report the percentage of the people who visited form and submitted it.