![]() |
| ||||||||
|
|||||||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
Active Warrior
Join Date: Apr 2007
Location: , , Ireland.
Posts: 74
Thanks: 0
Thanked 1 Time in 1 Post
|
I have a site that gets good traffic from Google and I want to track what keywords are converting from the natural searches.
Can anyone tell me how I can use php to grab the keyword information when someone lands on my page after finding it on a search engine. I will then attach that keyword to a variabl (I can do this part )Cheers, Dave |
|
|
|
|
|
#2 |
|
Active Warrior
Join Date: Jul 2006
Location: , , South Africa.
Posts: 49
Thanks: 0
Thanked 3 Times in 3 Posts
|
Hi you can grab a url string variable sent through google and store it in a msql database.
Look for the this code in the url string. "www.google.co.za/search?q=make+money&ie=utf-8&oe=utf-8&aq=t&client=firefox-a&rlz=1R1GGGL_en___ZA347" where q=make+money is what you want to store so you will get the variable by doing the following $keyword = $_GET['q']; This will store the search term in a variable called "keyword" now you just need to store the variable data in the in the mysql database table. Hope this is useful? |
|
Visit http://www.superimtips.com for the latest IM tips and news
|
|
|
|
|
|
|
#3 |
|
Web Developer
Join Date: Nov 2008
Location: Asheville, NC USA
Posts: 151
Thanks: 1
Thanked 23 Times in 21 Posts
|
That's not really a helpful solution, and is actually incorrect. The $_GET variables are only available if they are present in YOUR website URL.
I believe the only way to do this is with the "referer" (notice the incorrect spelling, it is actually correct). The referer header doesn't always get sent by the browser, but it is usually there. http://www.electrictoolbox.com/php-h...erer-variable/ You should then dissect the url string to find what keyword is being searched for. The search term in a Google search looks something like this: Code:
http://www.google.com/search?q=hello+world&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a |
|
|
|
|
|
|
|
|
#4 |
|
Advanced Warrior
War Room Member
Join Date: Apr 2006
Location: Tucson, AZ, USA.
Posts: 972
Thanks: 106
Thanked 143 Times in 103 Posts
|
Wayfarer is correct. You have to look at the REFERER. I found this code here. It seems to work fine in a quick test.
PHP Code:
|
|
Executive I.T. consulting for small/medium business
Website development | PHP - MySQL - JavaScript expert programming Software requirements analysis | Specification writing Project management | Vendor relationship management |
|
|
|
|
|
|
#5 |
|
Active Warrior
Join Date: Jul 2006
Location: , , South Africa.
Posts: 49
Thanks: 0
Thanked 3 Times in 3 Posts
|
Oh well that is the way I'm doing it and it works fine for me. Yes you obviously want to see who the referrer is like google, yahoo, bing etc, but that was just a simple quick explanation. I just thought that you already knew the rest
|
|
Visit http://www.superimtips.com for the latest IM tips and news
|
|
|
|
|
|
|
#6 |
|
Active Warrior
Join Date: Apr 2007
Location: , , Ireland.
Posts: 74
Thanks: 0
Thanked 1 Time in 1 Post
|
hey fellas,
thanks for your help with this, much appreciated. Dave |
|
|
|
![]() |
|
| Tags |
| header, http, info, retrieve |
| Thread Tools | |
|
|
![]() |