Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!


Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 




From the folks who brought you High Rankings!


Analytics Site Search

  • Please log in to reply
4 replies to this topic

#1 Kris


    HR 2

  • Members
  • PipPip
  • 39 posts
  • Location:Geordie Land, United Kindom

Posted 13 July 2012 - 09:10 AM


I have attempted to setup Site Search within Google Analytics and both methods I have read and used still fail to show up any results within GA.

Because my search form POSTs instead of GET's, the URL does not contain the search query paramaters, so I am having to use the _trackPageview() method on my search results landing page to push the search keywords to Google. I have tried the following methods below but I still have ZERO results in my Site Search results page:

Method 1:

var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview('/searchfor/?q=<?php echo urlencode($searchterm); ?>');

Method 2:

_gaq.push(['_trackPageview', '/searchfor/?q=<?php echo urlencode($searchterm); ?>']);

I have enabled Site Search within my GA profile settings and I have also set the letter 'q' as my search parameter.

Any ideas what I am missing? Its sooo frustrating as my search results page is the 2nd most used page one my site!

Thanks in advance.

#2 Michael Martinez

Michael Martinez

    HR 10

  • Active Members
  • PipPipPipPipPipPipPipPipPipPip
  • 5,325 posts
  • Location:Georgia

Posted 13 July 2012 - 06:09 PM

I am guessing you have already reviewed all the steps outlined here. I'm not sure that _trackpageview was really meant to work with POST events, since it is trying to capture refreshes of the current page, not new URL loads.

What are you using to power your site search? Is it your own tool or something else?

#3 Kris


    HR 2

  • Members
  • PipPip
  • 39 posts
  • Location:Geordie Land, United Kindom

Posted 16 July 2012 - 05:19 AM

Hi Michael

I have read that _trackpageview() can have arguments sent to it regardless if the search form is GET or POST, its just a method from the GA API as far as I understand. Typically a standatd HTML post form would use GET and pass the arguments along the URL, of these we can send to GA for analysis which is what I am doing but via POST, simply sending the search term as an argument to the trackpageview() method. The form is my own HTML form, nothing tricky. Very simple.

I have setup everything as described in your link. Its just very frustrating not understanding why the results will not show up!

I guess I will just resort to phoning Google Technical Support Hotline and get a human answering the phone within 3 rings. Anyone know the number??

Edited by Kris, 16 July 2012 - 05:20 AM.

#4 chrishirst


    A not so moderate moderator.

  • Moderator
  • 7,718 posts
  • Location:Blackpool UK

Posted 16 July 2012 - 07:23 AM

Put the tracking info in the action attribute value of the form open tag.

#5 Kris


    HR 2

  • Members
  • PipPip
  • 39 posts
  • Location:Geordie Land, United Kindom

Posted 16 July 2012 - 08:03 AM

Thanks chrishirst

I resorted to changing my for to GET in the end and it works fine now. Out of interest I wil ltry the form action method you suggested.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

We are now a read-only forum.
No new posts or registrations allowed.