Cardinal Path’s response to COVID-19 Cardinal Path is sharing all we know to help marketers during COVID-19.  Learn more.

Usually you won’t get a lot of traffic from Images Search – close to nothing in fact – but for certain web sites with a high volume of organic traffic, around 85%, and good quantity of search engine optimized images it can be close to 13% of the total visits.

This added traffic sure will help you get some extra conversions and who doesn’t want that? Optimizing images should be a tactic in your organic search strategy.

Optimizing images is not that difficult, but it is a task you have to do every time you upload a picture. And unfortunately there is no easy way to know the yield of this work.

Web analytics tools are not going to tell you (at least not right out the box) the quantity of Image Search traffic, the keywords user searched at Google Images, the exact image that is appearing on the search engine results pages, nor the exact page in your site where the image is allocated.

PHP script to the rescue

It would be fantastic to have all these details to help your image optimization work and here is where I come in, with a piece of PHP code.

This script is doing three basic tasks:

  • Getting the referrer
  • Guess which of the major search engines is, Google, Yahoo or Bing
  • Analyze the query string and extract as many relevant details as possible


                            echo “Image url: $params[imgurl]

                            echo “Page of image: $params[imgrefurl]

                            $prev_values = array();


                            echo “Keywords: “.$prev_values[“/images?q”].”


                  case “/images/view”:

                            // Yahoo Images

                            echo “Search Engine: $url[host]

                            echo “Image url: http://$params[imgurl]

                            echo “Page of image: $params[rurl]

                            echo “Keywords: $params[p]


                  case “/images/search”:

                            // Bing Images

                            echo “Search Engine: $url[host]

                            echo “Keywords: $params[q]



                     echo “Non major Search Engine”;



What kind of data can be collected

Google Images is the one who is going to send most of this traffic, Yahoo Images send very little or nothing and the day I see Bing Images sending any visit is yet to come, but who knows?

Both Google and Yahoo are passing: keywords, Image URL and URL of the page in your site, as well as the search engine with the specific country code, so we can grab them all.

Bing is only going to tell the keywords the user searched, not surprisingly.

What else?

Feel free to modify the way you want the script to insert it in your site and collect all this data.

If your site is not using PHP as a server side script language you still can take the idea and replicate it in your favorite language.

My recommendation is to have a table in the database gathering the details with a time stamp, giving you some basic stats of when the visits from images are coming and the number of them.

More than just the insights you can get, this represents the possibility to delve into behavioral targeting according to what brought the visit to the site, just add your imagination.