Google Analytics Site Search With Custom Search Engine

December 14, 2007

“Why isn’t my Custom Search Engine working with Site Search?”

Since I had never used Google’s Custom Search Engine before (shame on me), my answer was:

“Gee, I don’t know, let’s look at the instructions.”

But the instructions were nowhere to be found. The truth is, it’s so easy, you just might miss it.

So I took a look. Site Search was turned on. Check. The Custom Search Engine script was on the page. Check. Results are being displayed. Check.

So what was the problem?

Custom Search Engine

I didn’t notice it at first. The results were being hosted on Google.

In order for site search data to be processed by Google Analytics, you need to bring them back to your site. So in your CSE control panel, under Code, make sure you selelct the iframe option and follow the instructions provided (which, as usual, just involves copying and pasting a little bit of JavaScript.)

Now, at this point you might ask “What the heck is an iframe and how do I do it?”

It is just the term that describes the technique used by Google to get their search results inside your page. Don’t be afraid. There isn’t any additional iframe-related implementation that you have to do.

Oh, and make sure that the new page you create for the results is also tagged with your GATC (Google Analytics Tracking Code.)

That’s it. See, I told you it was easy.