Before even thinking of using this keep in mind Google's policy against automated queries. This script is for educational purposes only and should not be used to make bulk automated queries.
Any SEO thinks and dreams of just one thing… traffic! But with our given SEO tools estimating it is not the easiest seo task and seo keyword research is rather hard. It's really hard to take a guess on what you can expect if you would rank for a certain keyword in the search engines.
You do have SEO tools such as Google Keyword Estimator, guesswork from Keyword Services such as Wordtracker but all are approximates, way off compared to the real traffic you can get in Google and others.
The traffic estimator from Google does not actually estimate search traffic but clickthrough in ads and the percentage of those who also check out the ads besides the organic serps fluctuates for each type of query.
I kept thinking of how this can be done at least to a certain level. I have an idea of some top traffic keywords and the traffic they can and even comparative analysis can work for me in this. And indeed, I ended up with a quite decent comparative anlysys.
Google Trends is one of the best comparative keyword search volume estimators. It compares up to 5 keyphrases and shows you a graphic with the evolution over a customizable period of time in certain chose locations or worldwide.
Given the fact that the data is mostly graphical it's not so easy to translate it in a human readable format. So I set myself up to find a way to get a text out of the Google Trends so I can do traffic estimation better. By knowing one word I can extrapolate an idea for others.
I actually came up with two solutions but I will just share one with you. First, the unshared solution, analyzes the actual image and traces the lines inside and records their evolution based on the color of each element assigned by Google Trends. Makes some averages and gives me a nice report which eventually, in short form, is cut down to the second solution.
Second solution will work easier. Will fetch the Trends page and load the info from it. By info I mean the keyphrase search volume bars shown at the bottom. And it fetches it for all displayed countries and cities and so on.
This article relies on the cUrl and PHP class provided on site.
<?
function fetchGoogleFrends($keywords,$date="all"){
if(!is_array($keywords)){
$keywords=preg_split("/[;,]+/",$keywords);
}
if(count($keywords)>5) return false;
$hc=new eHttpClient();
$html=$hc->get(
"http://www.google.com/trends?q=".
urlencode(implode(",",$keywords))."&date=".$date.
"&geo=all&graph=weekly_img&ctab=0&sa=N"
);
if(!preg_match("/<div id=legend>(.*?)<\/div>/si",$html,$keywordLegend)){
return false;
}
$keywordLegend =$keywordLegend[1];
if(!preg_match_all("/<font size=-1 color=#?([^>]+)>([^<]+)<\/font>/is",
$keywordLegend,$keywordsColors))
return false;
$keywordsColors =array_combine($keywordsColors[1],$keywordsColors[2]);
if(!preg_match_all(
"/<td align=left valign=top style='padding: 3 3 5 3'>(.*?)<\/td>".
"<td valign=top style='padding: 6 3 5 3'>(.*?)<\/td>/si",$html,$pcs)
){
return false;
}
$names = $pcs[1];
$datas = $pcs[2];
foreach($datas as $key => $data){
if(!preg_match_all(
"/<table class=bar cellspacing=0 width=([0-9]+) height=4>".
"<td bgcolor=([^>]+)><\/table>/s",$data,$pcs)
){
continue;
}
$datas[$key] = array_combine($pcs[2],$pcs[1]);
}
$results = array();
foreach($names as $key => $name){
$newdatas = array();
foreach($datas[$key] as $dkey => $dval){
$newdatas[$keywordsColors[$dkey]] = $dval;
}
$results[strip_tags($name)] = $newdatas;
}
return $results;
}
//--- This is how U use it!
print_r(fetchGoogleFrends("equity,insurance,loan,mortgage,casino"));
?>
It uses regexp to expose as an array the data search volume data found in Google Trends. Just figure out the countries from the array you need to use. You can also easily alter the script as you need! This script will rank the terms you choose. You need to be aware of traffic on one term to estimate the rest. If one's value is twice the other it has twice the volume and so on. And then imagine the long tail traffic!
Enjoy it and linkback if you like it.
Post Feedback