![]() | | ||||||||
| | #1 |
| Active Warrior Join Date: Apr 2007 Location: , , Ireland.
Posts: 92
Thanks: 0
Thanked 3 Times in 3 Posts
|
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 |
| Morné Zeelie War Room Member Join Date: Jul 2006 Location: , , South Africa.
Posts: 74
Thanks: 0
Thanked 6 Times in 6 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? |
|
Great Tutorials on WordPress development <a href="http://teachingyou.net/">Click Here</a>
| |
| | |
| | #3 |
| Web Developer Join Date: Nov 2008 Location: Asheville, NC USA
Posts: 420
Thanks: 18
Thanked 57 Times in 51 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 |
| Wayfarer | join me on StoryBlorg | |
| | |
| | #4 |
| Senior Warrior Member War Room Member Join Date: Apr 2006 Location: Tucson, AZ, USA.
Posts: 1,025
Thanks: 120
Thanked 158 Times in 115 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 |
| Morné Zeelie War Room Member Join Date: Jul 2006 Location: , , South Africa.
Posts: 74
Thanks: 0
Thanked 6 Times in 6 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 |
|
Great Tutorials on WordPress development <a href="http://teachingyou.net/">Click Here</a>
| |
| | |
| | #6 |
| Active Warrior Join Date: Apr 2007 Location: , , Ireland.
Posts: 92
Thanks: 0
Thanked 3 Times in 3 Posts
|
hey fellas, thanks for your help with this, much appreciated. Dave |
| | |
![]() |
|
| Tags |
| header, http, info, retrieve |
| Thread Tools | |
| |
![]() |