views:

26

answers:

2

I'd like to write myself a simple script that uses AJAX to load the content from each page on my main navbar into a hidden div on the current page.

This is just so that I can preload as much of my important content as possible and get it cached on the user's computer (hopefully) before they've finished with the current page and want to move on.

I'm concerned that doing a request for every page on the site, every time someone visits, will really ruin the validity of my google analytics stats.

How does AJAX interact with google analytics? Does it count as a "page visit"?

+1  A: 

If you retrieve each page without running the embedded script, then the Google Analytics code would not be run and it should not count as a page view. I suggest not doing anything with the code after retrieving each page (i.e. not inserting the content into a hidden div).

Jeffery To
great. Its easy enough to remove the analytics script from the DOM before I drop it in the page.
David Meister
+1  A: 

If you want to ajaxify your site by removing pages and replacing them with ajax requests, then all you need to do on the GA side of things is call _trackPageView whenever a page view should be tracked.

Erik Vold