Marcus Edensky
Marcus Edensky

Reputation: 944

Record visitor search keywords or traffic source in PHP

I'm working on an Easter Island site with lots of info on the island, but also possibility to book tours etc. For a general idea of how people find my site I use StatCounter and Google Analytics, but I'm especially interested in how those who send me booking inquiries find my site.

I would use php session variables to store the info and e-mail it to me at the same time I receive an inquiry - perhaps even create a database for the purpose of having statistics, but the question is:

How do I fetch the search words or the url the visitor is entering from?

Upvotes: 0

Views: 2695

Answers (2)

Paweł Piecyk
Paweł Piecyk

Reputation: 2789

You can use $_SERVER['HTTP_REFERER'] - check the manual.

Upvotes: 2

MaveRick
MaveRick

Reputation: 1191

You have to store these information in cookies, If the users first time visit the website you can add all of the queries he is submitting to search box and append it to some cookie variable separated with | or / or any other char then add it to some field when he enquire something through the contact form.

Upvotes: 0

Related Questions