PHP使用cURL数据提交表单,并在计时器上跟踪代码自动重定向

I am currently working on a form that has specific user related data on curl call which is why "$form->data" line is required. I have to add a tracking code (google) to a thank you page that needs to auto redirect after a certain time on the page. So the process would be like this:

  1. User completes form.
  2. Form redirects to thank you page with tracking code.
  3. Thank you page redirects to login page after say 10 seconds.

Here is the code I currently have on the thank you page, that as far as I know does not trigger the Google tracking code because it redirects immediately:

<?php header('Location: '. $form->data['curl_data']->url );
die(); ?>

I also tried via javascript:

<script>
$(document).ready(function () {
window.setTimeout(function () {
location.href = $form->data['curl_data']->url; }, 5000);
}); 
</script>