Google Analytics Site Search with Custom Search Engine

“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.

Share and Enjoy:
  • Print
  • email
  • Digg
  • Reddit
  • StumbleUpon
  • del.icio.us
  • Google Bookmarks
  • Facebook
  • Twitter

Related Posts

  1. How to Set Up Google Analytics Site Search without Query Parameters
  2. The new Google Analytics: Part I, Analytics for Site Search
  3. How to Set Up the new GA Site Search
  4. Google Analytics Custom Variables, Part I: Why?
  5. Custom Variables, Part II: The Code

28 Responses to “Google Analytics Site Search with Custom Search Engine”

David Cox says:

Why is it that Google does not put this in the help information. Thank good ness I found this I have been trying to make this great feature work and it just would not. I can not wait to see the report tomorrow since this will greatly help me refine the site based on user input. Thanks for the post and i am glad to have found it.

THANK YOU! I’ve been struggling for days to figure out why Google Analytics wasn’t showing our custom search engine results!

You’re an angel. Now, tell me why this information isn’t on Google’s extensive help pages.

Robert Weide says:

I agree with the comments above. The analytics help makes it seem just a little too simple. THis really should be in there, thanks for writing it down!

Karsten says:

How can I use the overlay and still get the search terms?

John says:

Karsten,

I’m not sure what you mean by using the over and still getting the search terms. If you can give an example, or try to explain it differently, maybe I’ll get what you’re asking.

Sorry,

John

I still don’t get this.
I have a search engine that is on my site. It searches different site (excluding my own site). I want to be able to see what my users are searching for.

Also, does your search engine and your analytics need to be under the same google account?

John says:

The search engine and analytics do not need to be under the same account. As along as you select display the results in an iframe, it should not matter that it searches a different site. Make sure you have the Google Analytics Tracking Code on the results page, however.

rio says:

Hello, i’ve pasted all the iframe codes in my wordpress based site. The Google CSE works well, but I can’t get the result in GA. I am sure the query term is correct. Does it matter to the search result landing page, which on my site is index.php instead of search.php?

thanks

John says:

The name of the page should not matter.

If the site is maxmsp.recorderz.org then it looks like the view of the results page is being correctly submitted to Google.

My best guess is to check in the Google Analytics reporting interface, under the “edit” for the profile and make sure Site Search is turned on, and the query parameter is set to “q”.

Sorry if that is not much help,

John

rio says:

Thanks John,

Yes, GA query parameter is set to “q”, Do not strip query parameters out of URL, default page is index.php and no excluded URL query parameters.

I doubt it’s because of i changed something in the iframe searchbox code, I wanted to take off the ugly search button, is that a problem?

rio says:

all the greater than symbol is taken off in the following code:

<form action=”http://maxmsp.recorderz.org/index.php?” id=”cse-search-box”
<div
<input type=”text” name=”q” size=”31″ /
<input type=”hidden” name=”s” value=”Search” /

<input type=”hidden” name=”cx” value=”008533982481158292571:4ril6chsahq” /
<input type=”hidden” name=”cof” value=”FORID:11″ /
<input type=”hidden” name=”ie” value=”UTF-8″ /
</div
</form
<script type=”text/javascript” src=”http://www.google.com/coop/cse/brand?form=cse-search-box” </script </div

rio says:

sorry, there shall be another line:
input type=”hidden” name=”submit” value=”"

John says:

Since you are not stripping query parameters check the Top Content report. Then search for q= to see if it is coming through.

It should be since the utm.gif request was being sent to google for the results page.

If that doesn’t help, try posting on http://groups.google.com/group/analytics-help A lot more people will see it there and maybe someone will catch something that I missed.

John

[...] article discussing tracking custom search engine by Robbin [...]

[...] article discussing tracking custom search engine by Robbin [...]

[...] article discussing tracking custom search engine by Robbin [...]

[...] article discussing tracking custom search engine by Robbin [...]

Clark says:

Very nice this option. Never read a thing about this until now. Google Analytics tracking script is just an other piece of javascript. Thanks to teach something new.

ruth says:

this was so helpful!!…”Oh, and make sure that the new page you create for the results is also tagged with your GATC (Google Analytics Tracking Code.)”
why soesn’t google anal-ytics post this?

Robbin says:

Well, John (who wrote this post a long time ago) also revised the GA Documentation to reflect some of these issues. But those kind of comments, “Oh, and be sure… ” etc tend to work better in a blog — Robbin

[...] article discussing tracking custom search engine by Robbin [...]

[...] article discussing tracking custom search engine by Robbin [...]

john Adam says:

thanks for sharing this. we have come to know some this new about google analytic

Mack says:

Yeah, in the way google collects the search queries for your site and it will increase your website visibility on the Google search Engine. Having site google custom search on your website is really a better idea, if you are depending upon the google search engine

Rob Cook says:

well i m totally agree with you my friend & it also solve my problem too, as its just simple to understand, about the tricks of analysis. thanks for facing us some new face of google.

Car Reviews says:

as its always to understand Google & its analytic, but while reading this google, i can say you solve atleast my some problem regarding this,

[...] article discussing tracking custom search engine by Robbin [...]

Leave a Reply

Feedback Form