Mobile app version of vmapp.org
Login or Join
Holmes151

: Proper Google Analytics setup for AJAX heavy page? Lets say I have a website with a few pages. The purpose of each of those pages is to display live statistics for a real world event (for

@Holmes151

Posted in: #Ajax #GoogleAnalytics #Seo

Lets say I have a website with a few pages. The purpose of each of those pages is to display live statistics for a real world event (for example, sports scores). Every 60 seconds, an Ajax call is made to the server to fetch the latest sports scores and the update the page with those scores. A user would typically open this webpage and leave it open for many minutes (maybe hours). They would never need to refresh the page because it always has the updated scores on it.

What would be the best way to track my user's experience on this page with Google Analytics. Obviously, when the page first loads, that page visit is logged. But then, every time some Ajax call occurs, what would I have Google Analytics do? I want to properly track time-on-site and page loads. Would each Ajax refresh be considered a new page load?

I've seen some sites suggest doing this when Ajax happens:

_gaq.push(['_trackPageview', '/somepage'])


That would be like telling Google Analytics that the user reloaded the page. Is this accurate? Or is there some other type of event to push that is more accurate for Ajax calls? Technically I guess you could tell GA to track the page view of the Ajax URL? Or would using custom GA events make more sense?

The reason I'm asking is, lets say down the line, some company wants to purchase my website from me. I would want to be able to show them my Google Analytics history and know that the pageviews and time-on-site is calculated accurately. I would not want someone to have a reason to question time-on-site or page views.

If I was using GA events instead of page views for the Ajax calls, would that accurately be taken into account for time-on-site?

Also, if I was running StatCounter on the site at the same time, is there a similar thing I would need to do for that as well?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Holmes151

2 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

It sounds like the AJAX calls are purely for a data refresh and not based on user activity. I don't think trackPageView or eventTracking are good candidates for reporting. Review how Google calculates time on site / active sessions. Event tracking should be used to track user interaction (stop, play, pause). Track Page view could be possibly used for something like tracking clicks between tabs that dynamically load other page content into a tab.

10% popularity Vote Up Vote Down


 

@Pierce454

Afaik GA events are your best option.

You could make GA to think there've been changes in the page, but that would mess all the other stats.

You provide AJAX for best user experience. You better redefine your key stats, the key one being not the traditional pageviews but time-on-site.
(see Avinash Kaushik for a better explanation: www.kaushik.net/avinash/podcast-measuring-rich-media-ajax-flash-flex-rss-blogs/)
I am not sure of this, but if you're asking your user to only read updated data, maybe you could track each AJAX refresh as a download event.
Would that make sense to you for the usage of the page? developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide?hl=en

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme