View Full Version : Adding Google Analytics to a non static web pages?

01-29-2010, 11:28 AM
I want to find out what is being most frequently searched in a database. Google Analytics has been suggested for this. I know analytics is easy to setup for static pages but not sure when the data will be changing for the same web page.

I've found this from the Analtyics site (http://www.google.co.uk/support/googleanalytics/bin/answer.py?hl=en-uk&answer=55504)

but it mentions adding the tracking code to the php pages but I don't see how this would work as different information is pulled back depending on what the user selects from the database.

Can anyone advise please?

01-29-2010, 06:36 PM
Adding Google analytics to a dynamic page is the same as adding it to a static page. However, it does not index page contents and so I don't think it will give you the information you're looking for.

As a first step, are you capturing the search terms people enter on your site?. You could start there (send search terms to a database when search field is submitted) and then come up with ways of grouping search terms later (if necessary).

01-29-2010, 10:31 PM
I think because PHP renders the code (and content) BEFORE it is sent
to the browser, the Google Adsense Javascripting would see the content
just as though it were static. I see no reason why it wouldn't work.

01-30-2010, 02:27 PM
Yes, server side scripts (PHP, .NET, whatever else) do transform data into HTML before returning it to the client. My question is whether Google Analytics indexes the entire page contents every time the pages loads. I doubt it, and therefore I doubt it can be used to track what he's looking for.

Then again...

Google Analytics does track URLs. Let's say when a user submits a search form, the target page puts the search term in the URL--something like this.

I know that Google Analytics will keep track of the number of visits these pages. What I don't know is what they do with URL parameters (i.e., everything after the ? in the URL). If it strips those, then this approach is useless, but if it keeps those it may accomplish what you're looking for.