How to track form submission?

I have a form on my website that sends some parameters to a php script which redirects the user to an external website.
Simplified form:


<form action='/php/handleSubmitForm1.php' method='post'>
  <input id='email' name='email' placeholder='Your Email...'/>
  <input id='category' name='category' value='categoryXYZ' type='text' style='display: none;'/>
  <button id='submitForm1' type='submit'></button>
</form>

Simplified php script example:


$email= $_POST['email'];
$category = $_POST['category'];
header('Location: ' . 'http://exampledomain.com/' . $category . '/?email=' . $email, true, 302);

How can I configure piwik to show me that the user exited to ‘/php/handleSubmitForm1.php’ and maybe even the post parameters?

I built a nice work around. Maybe this is usefull to some of you:
This code assumes that you have the piwik include code in “…/inc/footer.inc” and is a replacement for the theoretical example of the first post.


<?php
$email= $_POST['email'];
$category = $_POST['category'];
$url = 'http://exampledomain.com/' . $category . '/?email=' . $email;
?>
<!DOCTYPE html><html><head>
  <meta http-equiv="refresh" content="0; url=<?php echo $url ; ?>" />
  <script type='text/javascript'> window.location = '<?php echo $url ; ?>'; </script>
</head><body>  
  <div style='display: none;><?php include("../inc/footer.inc"); ?></div>
</body></html>

The user doesn’t even need to have javascript enabled. :slight_smile:

don’t use the javascript redirecting code:


<script type='text/javascript'> window.location = '<?php echo $url ; ?>'; </script>

If you use it, piwik will fail to gather the user data. The pure html meta redirect by itself is fine, even though it’s a bit slower.

Also Form Analytics is coming soon! Check the page to learn more and be notified when it will be launched. :rocket: