Tutorial: Use PHP to display exclusive content for Google Visitors

While browsing through my visitor referrals this morning, I noticed that a large number of unique visitors are making their way over to my little site from Google Images. A quick look at bandwidth usage shows that the majority of visitors are just looking for images to leech for MySpace profiles, etc, which I don’t mind so long as it doesn’t get out of hand.

So, I thought about it for awhile. I have several thousand visitors a month showing up on my “artwork” page and they’re nearly all coming from the same place.

What if I could have a message that would be shown only when a visitor arrived from Google Images? That might be something worth playing around with ;).

Well, having seen similiar things before, I knew it was possible. After a bit of digging and a tip in the right direction, compliments of performancing.com, I found a solution.

First, let’s see it in action. Visit my artwork page and you’ll see it as the average visitor to jonathanwold.com will see it.

Next, head on over to Google and do an image search for “blue flames“, one of my more popular search terms. Depending on your country, the name “Jonathan” should be somewhere in the top 10 in blue flames. Click on it and you’ll see the message for Google Images visitors. (Don’t see it? Let me know ;)

Alrighty, now for the code! Copy and then paste the code below into notepad (or similiar plain text editor) to clear any formatting tags, then use on a PHP page and enjoy!






Your Message Here - You can use HTML ;)




And there you have it. Paste the code into the PHP page you wish to use it on and modify the HTML section as appropriate. In my particular situation, I included a CSS styled DIV tag to display my visitor notice. You can change the “referer” from images.google.com to whatever you’d like. Use your imagination :). Alrighty, and that’s that for this morning! Enjoy and if you have any questions, comments, or suggestions, add them in the comments below or send me an email.

Have a wonderful rest of the day! : )

-Jonathan