Thought I might share a neat Awstats hack of mine that I use to read my referer data better. This simple hack/addon is nothing more than a bit of regex. It takes your search traffic data and puts it into separate Yahoo, MSN, and Google tables. It also grabs your traffic from Digg.com and puts them into a nice table organized by referring page.
ScreenShot (Click To Enlarge)
Installation
All you got to do is append the code below into your sites’ conf file. Your conf file on a standard Cpanel setup is usually located in the /tmp/awstats/awstats.mydomain.conf folder below your root in the ftp. Place the code at the bottom, save, and reupload. Be sure to make a backup of your previous conf file even though this should be pretty foolproof.
If you got any requests for additions to this hack drop a comment and let me know.
thanks. another great post. ill try this later. bookmarked..
*sorry had to edit links out*
Bonus For The People Who Read The Comments
Tracks referals from Google Images
Just add this below the others in the conf file.
Cool Eli. Thanks for that!
Cheers Eli, never paid enough attention to realise you could do this sort of thing with awstats!
This is brilliant.
You, sir, are both a scholar and a gentleman!
Does not work for me on a very busy site with about 2500 unique visitors per day. However works on a site with less traffic. Anyway - thanks for sharing.
Christoph
It doesn’t matter if you receive 100 people per day or 300 trillion people a day. This is still useful.
This line here
MaxNbOfExtra5=10
That line determines how many results to show.. (like this one is top 10)
This is top 5
MaxNbOfExtra5=5
Its not going to show you every single one that came thru..
I think your fulla shit cracker. Why don’t you enlighten us to all the ways you make all of this money online rather than slamming other folks?
Yeah, it’s just too easy to say things like “I made 56million bucks yesterday, and this site is full of shit.”
Who are u Cracker? Someone who doesn’t implement anything from here. You are wasting your time here, and time is money, so you are funny:)
It was a good tip Eli, Thanks.
I deleted joe crackers comment. Incase you were curious he said the usual “This sucks you should spam myspace.” haha kind of like trying to sell cookies to the other girlscouts wouldn’t ya say? He also said he makes $xxx for his 100k visitors/day which means he’s officially got the lowest payouts and conversions in all of myspace spam history.
Getting boring so he’s banned from commenting.
sounds good
my AWSTATS conf file keeps reverting back to its original state a day after I add the code.
Anyone know why?
Are you on a cpanel setup?
Cpanel runs a cron that rebuilds all those config files daily.
Is there any way to turn this off (so we do not have to do the Chron job- as I can see that it may lose stats if done at the wrong time) or is there a way to find out when it does it, so we can time the chron job to place the code a minute after it updates?
Better still, what do we ask of the webhost? Are they able to do it their end? I have asked them before, but they cannot seem to work out how. I have 2 hosts, both with Cpanel, and one updates the conf file and the other does not.
The default awstats config file for cpanel is located at
/usr/local/cpanel/etc/awstats.conf
It would require root permissions to edit that file.
If your on shared hosting you’d have to manually upload your config file each time… Pain in butt…
Or make a cronjob that did it for you daily =)
Here’s the perl code for the cronjob. Don’t forget to put your perl headers at the top #!/usr/bin/perl or whatever.
$path_to_conf = '/home/mydomain/tmp/awstats/awstats.mydomain.conf';
$append_code = qq~
ExtraSectionName1=”Google Search Keywords/Phrases”
ExtraSectionCodeFilter1=”200 304″
ExtraSectionCondition1=”REFERER,^http:\/\/www\.google\.[^/]+\/search\?.*q=.*$”
ExtraSectionFirstColumnTitle1=”Search Phrases”
ExtraSectionFirstColumnValues1=”REFERER,[?&]q= *([^& ][^&]*[^& +])[ +]*(&.*)?$”
ExtraSectionFirstColumnFormat1=”%s”
ExtraSectionStatTypes1=PHBL
ExtraSectionAddSumRow1=1
MaxNbOfExtra1=10
MinHitExtra1=1
ExtraSectionName2=”Yahoo! Search Keywords/Phrases”
ExtraSectionCodeFilter2=”200 304″
ExtraSectionCondition2=”REFERER,^http:\/\/(\w*\.)*search\.yahoo\.[^/]+\/.*$”
ExtraSectionFirstColumnTitle2=”Search Phrases”
ExtraSectionFirstColumnValues2=”REFERER,[?&]p= *([^& ][^&]*[^& +])[ +]*(&.*)?$”
ExtraSectionFirstColumnFormat2=”%s”
ExtraSectionStatTypes2=PHBL
ExtraSectionAddSumRow2=1
MaxNbOfExtra2=10
MinHitExtra2=1
ExtraSectionName3=”Live Search - MSN Search Keywords/Phrases”
ExtraSectionCodeFilter3=”200 304″
ExtraSectionCondition3=”REFERER,^http:\/\/search\.(msn\.[^/]+|live\.com)\/.*$”
ExtraSectionFirstColumnTitle3=”Search Phrases”
ExtraSectionFirstColumnValues3=”REFERER,[?&]q= *([^& ][^&]*[^& +])[ +]*(&.*)?$”
ExtraSectionFirstColumnFormat3=”%s”
ExtraSectionStatTypes3=PHBL
ExtraSectionAddSumRow3=1
MaxNbOfExtra3=10
MinHitExtra3=1
ExtraSectionName4=”Digg.com Visitors”
ExtraSectionCodeFilter4=”200 304″
ExtraSectionCondition4=”REFERER,^http:\/\/(\w*\.)*digg\.[^/]+\/.*$”
ExtraSectionFirstColumnTitle4=”Digg Referers”
ExtraSectionFirstColumnValues4=”REFERER”
ExtraSectionFirstColumnFormat4=”%s”
ExtraSectionStatTypes4=PHBL
ExtraSectionAddSumRow4=1
MaxNbOfExtra4=10
MinHitExtra4=1
ExtraSectionName5=”Google Image Keyphrases”
ExtraSectionCodeFilter5=”200 304″
ExtraSectionCondition5=”REFERER,^http:\/\/images\.google\.”
ExtraSectionFirstColumnTitle5=”Keyphrases”
ExtraSectionFirstColumnValues5=”REFERER,^.*q\%3D(([^\%]|\%[^2]|\%2[^6])*)\%26.*$”
ExtraSectionFirstColumnFormat5=”%s”
ExtraSectionStatTypes5=PHL
ExtraSectionAddSumRow5=1
MaxNbOfExtra5=10
MinHitExtra5=1
~;
open(OUTF,”>>$path_to_conf”);
print OUTF “\n\n$append_code”;
close(OUTF);
Than just set it to update every night immediately after your awstats automatically updates(about 12:30am).
Eli, your on vacation.. Most people don’t troll around forums and lurk on blogs during vacation..
go camping, get drunk, goto the dairy queen and get a flameburger, or stop by here and pickup some money.
-rob
I heart Blue Hat SEO
My awstats hacking consists of simple wget referer spam:
http://www.google.com/search?hl=en&lr=&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=Q0s&q=site%3Aedu+OR+site%3Agov+%22Links+from+an+external+page+%28other+web+sites+except+search+engines%29%22&btnG=Search
Holy shit!
nice comment!
Notice that the first result is a pr6
Hi Eli and GlobalwarmingAwareness..
I know you posted these comments about 6 months ago, but I’ve just found your blog and I am thoroughly enjoying it..
WRT to Awstats idea, what do you guys see as the best way to take advantage of this AWSTATS info you found in Google.
Initially I thought of using something like running a simple script that would call the root site with the HTTP_REFERER tag containing the site I want to promote, but is this the best way to tackle it..
Hopeing you can help
bruce
Awesome post. This will help a lot. I added your blog to my blogroll. This place is great.
Also there’s other packages that can be targeted, analog and webalizer come to mind. Bunch more here: http://en.wikipedia.org/wiki/Web_log_analysis_software#Popular_log_analyzers
You could also try stuffing the stats page with keywords through a google search referer. I’m not sure, but it may be possible to use keywords like keyword
Very useful hacks, thanks a lot, I already implemented them.
I was trying to modify the hacks to make it possible to track specific referrals but my hacking knowledge is rather limited, hence I didn’t succeed.
Is there a standard hack where one just can replace the url in order to track from which pages on a domain visitors are coming. That would absolutely great.
Hi Eli,
You forgot to say that you copied these great hacks from http://www.internetofficer.com/awstats/keywords-by-search-engine/
David
Actually, you forgot to give me credit
Your post date: Feb. 19th 2007
Mine: Jan. 19th 2007
:(
Credit where credit is due, would be I guess the Awstats documentation where most of this info is.
No worries though as long as the info gets out there and helps people, I’ll keep your link up anyway because you have a few useful comments in that post that I think everyone here should read. BTW my compliments on your blog I’ll add it to my reader and maybe add it to the blogroll here as well.
Nice Stuff!
Loads of different hacks and mods here to
sorry that didnt work here > http://computech-pcs.co.uk
cron jobs, php coding, mysql its all too much to take in!
AWstats is really useful though and i’m sure lots of people find this post useful too.
Interesting. So much hacking. It must be human nature to want to hack anything and everything
Cool. Great tip Eli
Error: The number of values found for extra section 5 has grown too large.
And I was only looking at a daily report! It would have been about 7000 uniques, 150,000 page views by this time of day. My awstats never had any trouble before the modification.
I was looking forward to this mod, it looked very promising.
Never used awstats, more of a Google Analytics guy.
There are some really great scripts out there (especially greasemonkey scripts) that put some extra data into your Analytics overviews.
I would certainly check them out.
-brad
Thanks for the script. It’s hard to sometimes organize all you traffic sources so you can see them all at once.
this is great! Thanks for that!
Didn’t know you could hack that as well.
Nice hack on Awstats.
Hey Eli,
I know this is a rather old post but I have just implemented your hacks and they work well.
For those who say the Extras exceed their lines in the log file, you should amend this line and increase the number:
ExtraTrackedRowsLimit=500
So count the lines in your access_log and increase the number with this.
I had two polite requests… I was wondering if you could possibly amend the regexp so that it rewrites the ampersand into & (my awstats are generated in xml and it will not parse anything if a & is found instead of &).
Also your Google images code works well but instead of spaces in the key phrases it displays + signs. Is there any way to modify it so it displays it with spaces like the other Extras?
Thanks alot and great blog, will keep on reading.
Sorry your comments seem to rewrite & amp; into a normal ampersand…
I´m using the AWSTast for years, but I never understand it to use it´s full potential… very good idea… thanks again
Simply a great piece of work.