412.343.3692
1.800.975.1844

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:
  • Digg
  • del.icio.us
  • StumbleUpon
  • Sphinn
  • Facebook

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

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

  2. Diana Brewster Says:

    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.

  3. 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!

  4. Karsten Says:

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

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

  6. Find Torrent Search Engine Says:

    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.

  7. Find Torrent Search Engine Says:

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

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

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

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

  11. 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?

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

  13. rio Says:

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

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

Leave a Reply