I guess the question is why do you want to keep them? Most ‘tracking’ systems set a cookie on arrival so you can track through the user journey.
Or the broader question would be how to do so for any reason, tracking or not. WP generates links in a number of ways, so there’d be a number of approaches to reliably modify all possible internal links. Using the “the_permalink” filter should deal with most internal links. add_query_arg() is a useful function FWIW.
Despite the ability to do so, I think it’s more reliable to save any values you need to persist between requests as cookie values. It can happen that query strings get dropped during rewrites and similar server processes.
Another way to have values persist is via session vars, but WP can have issues when PHP sessions are not well implemented.
Yes – as above, but basically use cookies ( like tracking systems ) 🙂
thank you, implemented through cookies
@alanfuller , @bcworkz , Could you please advise me, made an implementation via cookies, in Chrome Firefox browsers works fine, but in Safari cookies are not set via script js ? what could be the reason for this behavior of Safari ? how to solve it ?
JS to set cookies should work across all common browsers. It may be your Safari is configured to reject cookies? You can send code to set cookies, but clients do not have to accept them. Users ought to know that refusing cookies can cause usability issues on some sites.