0

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>
boloneysandwich
  • 157
  • 1
  • 9
  • redirect using javascript? https://www.tutorialspoint.com/How-to-use-JavaScript-to-redirect-a-webpage-after-5-seconds – Funk Doc Apr 29 '19 at 15:59
  • https://stackoverflow.com/questions/17150171/page-redirect-after-x-seconds-wait-using-javascript here you can redirect using javascript after N seconds – Mangesh Sathe Apr 29 '19 at 16:02
  • Cross browser testing is required – Mangesh Sathe Apr 29 '19 at 16:02
  • https://mediatemple.net/community/products/dv/204645160/how-do-i-redirect-my-site-using-a-meta-tag – Pedro Lobito Apr 29 '19 at 16:13
  • So I have tried javascript `` but it does not redirect with the $form-> data line. Ideas? – boloneysandwich Apr 29 '19 at 16:14
  • I'm presuming you have installed jQuery? and it should be window.location.href – ColinMD Apr 29 '19 at 17:02

0 Answers0