It’s quite commonplace for a CDN to use their domain in the URL for your resources, since they are the ones hosting them after all. Since custom CDN URLs matching your server are usually an added cost from CDN providers, most people settle for the server CDN URL, which usually looks something like this:
Since your images are being hosted on a different domain, they won’t show up in Google Search Console when you set up your site because you don’t have ownership of example-cdn.com. A step is required in order to authenticate your ability to access data.
Fortunately there is a way to have the best of both worlds!
Read on to learn how to use a CDN for your resources and make sure all your images are being indexed, plus track all the valuable data for them in Google Search Console just as you would if you hosted the images yourself.
A Note on Google Analytics and Google Images
In case you are new to Google Analytics, it is worth noting that you won’t be able to drill down to referral traffic specifically from Google Images in Google Analytics. The Google Analytics team tested this and decided against it back in 2018:
After testing and further consideration, we have determined that the best place to measure query and click traffic from Google Images is in the Search Console Performance Report. Accordingly, we will continue to use https://www.google.com (or the appropriate ccTLD) as the referrer URL for all traffic from Google Images, and will not be providing a Google Images specific referrer URL (images.google.com)https://developers.google.com/search/blog/2018/07/an-update-to-referral-source-urls-for
With that in mind, let’s get started with Google Search Console.
5 Steps to CDN Image Tracking in Google Search Console
1. Add a CNAME to your DNS Records
The first step involves adding a CNAME (Canonical Name) to your DNS (Domain Name Server) records. A CNAME can be used to alias one domain to another.
All hosting platforms have different interfaces but should all have a similar setup for adding a CNAME entry. To achieve what we want for our images, we want to set up a subdomain. We’ll use the word ‘images’ for our subdomain, to make things easy to follow.
Here’s what it should look like:
|Type||Label/Host field||Time To Live (TTL)||Destination/Target field|
This will allow Google to recognize an image hosted at:
is the same thing as
2. Add a Subdomain in Google Search Console
Next, we will want to add our newly created subdomain to Google Search Console.
- Add a New Property in Google Search Console
- Select the Domain property type and use the subdomain you created in your DNS records, excluding the protocol, e.g. images.your-site.com
Presumably your primary domain would already be set up in Google Search Console, and with that you should see this Ownership auto verified prompt:
Otherwise we recommend setting up your primary domain in Google Search Console too, and following the prompts to verify ownership.
3. Create an Image XML Sitemap
Once the subdomain is set up in Google Search Console, the next step is to create an XML Sitemap for all of the CDN image URLs. You can list up to 1,000 images in a single XML Sitemap, so if you have more than 1,000, simply create as many XML Sitemaps as you need.
To do this you could use a program like Screaming Frog to crawl your site and find all of the CDN image URLs populating under the External > Images section. From there you would simply filter the report to only show images on your CDN and not any other external sources. Here is a more comprehensive guide on how to complete the XML Sitemap generation with Screaming Frog once you have your list of images.
Alternatively, here’s a list of XML Sitemap generators that you can browse.
Name it something recognizable such as ‘images-sitemap.xml’ and upload it to the root of your primary domain so it can be found here:
Note that in order for your images to surface in Google Images, your images are required to be on an indexable landing page. Standalone images won’t get indexed. So don’t include any images in this XML Sitemap that do not have an associated landing page.
Consider Adding Image Metadata
Photographers, photo agencies, and other related industries are often required to provide information about their images in image metadata. They typically do this by embedding the image metadata in the image file with specific programs. This has the added benefit of displaying copyright information in Image Search results (see right).
Image metadata isn’t just reserved for specific industries — anyone can add and use it, and it can be done via an XML Sitemap. The image metadata values that are available to use in an XML Sitemap include a caption, location, title and link to a license page.
This provides Google with more context around your images, which as a result can be better categorized in Image Search, which can in turn lead to higher quality traffic to your site.
Below is an example of a single image entry in an XML Sitemap with metadata:
4. Add the Image XML Sitemap to robots.txt
Add a line in robots.txt that points to the new image XML Sitemap:
5. Submit the Image XML Sitemap to Google Search Console
Last step is to submit your images-sitemap.xml to the new subdomain profile that you set up in Google Search Console.
Now all you have to do is sit back and wait a couple of days for Google Search Console to begin associating your CDN images with your domain.
Special Consideration for Yoast SEO and WordPress
If you are also using Yoast SEO plugin on WordPress, there is another step you can take to ensure images are being indexed properly.
Add the snippet of code below to the top of the functions.php file, replacing your-site in both URLs with your own, and images to your subdomain:
This change will allow Yoast to properly generate the XML sitemap for your WordPress site by using the subdomain URL to reference your images.
Once you’ve updated the functions.php file, be sure to go into the Yoast SEO Sitemap settings and regenerate the XML sitemap.
What To Do With Image Data
Images are a fantastic way for your content to be discovered. An image can explain so much, so quickly. The key is to understand how you can leverage it for your site’s purpose. For example, for an online car parts business, a step-by-step guide for a Honda Civic engine rebuild can be far more useful with images than without. For a SaaS product, screenshots can help potential customers quickly see if your software is user-friendly or right for them.
As image data arrives in Google Search Console you will have a greater understanding of how users are finding your site through visual means.
Google Search Console will be able to show you the queries that people used, the pages these images were on, and subsequently may have visited. As well as the users’ device type and their countries. All valuable information that can help you see where your image strategy is most effective and where it may need more attention.
Take a step back on your content strategy and think through how you can integrate more unique, useful images to bring in more traffic through Google Image Search.