This is a quick follow up to my earlier post on Google stopping sending referral data for logged in users and users of Google’s SSL host at https://www.google.com/.
There have been various values for the number of affected searches floating around. Matt Cutts has mentioned “single digits” for example. I though it would be useful to have a quick way to check how much that change affects your own site, so I whipped up a small *nix Bash script you can run on your server if you have shell access. The scripts makes some assumptions about the Apache log file location based on cPanel standard setup. So, if you are on a different server, please adjust the path to log file accordingly. Likewise, if you log is not in Apache standard format (unlikely), adjust the highlighted lines with awk commands accordingly.
#!/bin/bash # # Google traffic with stripped referrals vs. normal referrals # http://www.1-script.com/ # echo "Please, wait. It may take awhile ..." tld='com' # most likely value. If your site is example.TLD (org,net,us,co.uk etc.), # change tld='TLD' log_file=$HOME"/access-logs/"*$tld # location of the log file on a cPanel system. # If you have different setup, adjust accordingly declare -i num_with_referrals=0 declare -i num_without_referrals=0 declare -i total=0 eval num_with_referrals=$(awk -F\" '($4 ~ /www.google/ && $4 ~ /q=.+\&/)' $log_file | wc -l) echo "Found visits with referrals. Please wait some more ..." eval num_without_referrals=$(awk -F\" '($4 ~ /www.google/ && $4 ~ /q=\&/)' $log_file | wc -l) total=$num_with_referrals+$num_without_referrals; percent=$(echo "scale=2;$num_without_referrals*100/$total" | bc) echo "=============================================" echo "| Google Traffic Breakdown |" echo "| http://www.1-script.com/ |" echo "=============================================" echo " Total visits: "$total echo " With Referral "$num_with_referrals echo " Without Referral "$num_without_referrals echo "=============================================" echo " Google Visits Without Referral: "$percent"%"
You can copy/paste the code above into a file of your choice directly on your server or download the script from Google Referrals with vs. without keywords and then upload it to your server, gunzip and run.
The output you can expect will look something like this:
Please, wait. It may take awhile ...
Found visits with referrals. Please wait some more ...
| Google Traffic Breakdown |
| http://www.1-script.com/ |
Total visits: 12880
With Referral 11512
Without Referral 1368
Google Visits Without Referral: 10.62%
So, in other words, the percentage of the no-referral visits is just right around there at 10%, slightly above “single digits”