PHP forms thank-you pages

Google Analytics filter page names

I used to script login forms, contact forms, registration forms, order forms,… that were displayed in a login.htm, contact.htm, register.htm, order.htm with the forms action attributes set to the same url. Once submitted, PHP checked the form fields and displayed a thank you message (or an error message) within the same html page. This is not the right way to do it if you want to track users that filled in the form correctly or the ones who abandoned filling in the form or the ones who filled it incorrectly and submitted it again…

If you want to get deeper into the statistics of your website thanks to Google Analytics tools, for example, it may be wiser to generate login-thank-you.htm, contact-thank-you.htm, register-thank-you.htm or order-thank-you.htm. Once the form is submitted, have PHP check what has to be checked through a form validation class (check for required fields, email fields,…) and redirect the user to the thank-you-page to display the thank you message if he filled it in correctly. If this is not the case, redirect him to a contact-error-email.htm page for example.

After some time, you’ll go to Google Analytics / Content / Full report : use the filter field at the bottom of the page to filter by “containing keyword” or “not containing keyword” with a value like ‘thank-you’ to display all pages containing those keywords and get statistics about those pages.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>