How do I retain url parameters the entire time a user browses my site?
-
30-10-2019 - |
Question
We have customers that come from other sites and I would like to retain a url parameter /?lead=openeye throughout the time that they're browsing. That way when they fill out a form I can capture the lead for sales.
How do I retain url parameters the entire time they're browsing the site.
Update..
I've began using a combination of sessions and cookies to accomidate this. It sort of works but doesn't seem to stick for more than a few seconds between pages.
In the header
<?php
$lead = $_GET['lead']; $_SESSION['lead'] = $lead;
$url = parse_url(get_bloginfo('url'));
setcookie("lead", $lead, 0, $url['path'], $url['host']); (set)
?>
To test
<?php
echo ($_COOKIE['lead']); // Lead Cookie
?>
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange