How to pass a keyword from URL but keep it hidden? (Adwords)
-
22-02-2021 - |
Question
I'd essentially like to know the keyword that takes a user to my site, but then hide it from the user. So...in my ads I could set up the URL as domain.com?keyword=KW, and then store the keyword in a PHP variable so that I can use it in emails/SMS messages to myself. I don't really want it shown in the URL though as it looks kind of messy.
Is there any way to actually achieve this?
Thanks!
Solution
Just do a redirect after the user gets to your site:
if(isset($_GET['keyword'])){
//do whatever function you need to do with the keyword data
$keyword = $_GET['keyword'];
//redirect
header("Location: /");
}
Obviously the location should be where you want to send the user. The "/" will put him at the page/root of where he was.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow