Wednesday, April 6, 2016

Google site ownership verification per DNS

Many (or perhaps all?) seo / webmasters all have their sites verified in Google search console (and others). There are currently several options to verify ownership of a site, usually a domain or a subdomain. Many people use a file that's uploaded into the root folder of their site or a meta tag on the homepage.

If you have access to a DNS, adding a TXT entry to the DNS is a great option. We actually use several methods to verify the same domains, for example the meta tag + DNS, or verification file + DNS to add some extra protection in case one breaks.

This is the official (new) guideline from Google, but it is also explained in GSC. There's a second page with the details for the 4 different DNS entry variations that can be used - up to now I only had seen the first two.
One adds just a TXT entry with some copy in it, and the copy starts with "google-site-verification=' and then adds a specific entry per domain.

We have lots of domains, and a dedicated DNS team, so I needed to test if they implemented correctly - and as usual a quick script.
Script to test DNS TXT entry for google verification is below, and the output works - as shown with domains with this entry, and below without.

Done with a few domains where I don't have the DNS entry:

while read domain; do
dig -t TXT $domain | grep "TXT" | grep "google-site-verification"

done < $1
Bookmark and Share