Andy Jarrett // Code. Develop. Create.

Tracking Googlebot with ColdFusion

I came across this little script which is a kind of Googlebot alert at http://www.mitchkeeler.com/tutorial_tracking_google.php. It could be worth sticking on a new site to be alerted when Google has arrived.Easy Version
<cfif findNoCase("googlebot", cgi.HTTP_USER_AGENT)>
<cfmail to="[email protected]" from="[email protected]" subject="Google has crawled yourdomainname.com"></cfmail>
</cfif>
Expert Version
<cfif findNoCase("googlebot", cgi.HTTP_USER_AGENT)>
   <cfset today = dateFormat(now(), 'dd/mm/yy')&timeFormat(now(), 'HH:mm:ss')>
   <cfset urlString = "http://"&cgi.SERVER_NAME>
   <cfif len(trim(cgi.QUERY_STRING))>
      <cfset urlString = urlString&"?"&cgi.QUERY_STRING>
   </cfif>   
   <cfmail to="[email protected]" from="[email protected]" subject="Google has crawled yourdomainname.com">
      Google Detected @ #urlString#
   </cfmail>
</cfif>
Warning: they are not tested yet so use at own risk.Obviously this has a few other uses, it could even be modified to see when the MSN bot or all of them coming across.

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️