Reputation: 185
I have an application that navigates mostly with AJAX, and a section where a user can view information. I would like to track how long users are viewing different pieces of information. I want to assume that as long as they have the information loaded in the <div>
they are "viewing" it. However when the user click on a link to "go to another section of the app" the <div>
gets loaded with different content, the page doesn't actually redirect.
Does anyone have a solution for this, or at least some thoughts to help me see something I cannot see right now?
Thanks
Upvotes: 2
Views: 106
Reputation: 334
You should call some function when you update your content.
Since there is no "onchange" event for divs, you'll have to call your function after the ajax process: See this answer for more info.
However, if your content doesn't change according to ajax calls, you should trigger some event when your div changes.
Hope I helped you: without any code fragment I can't do more!
Upvotes: 0
Reputation: 57721
Most analytics software will allow you track this. I have some experience with Google Analytics and it's something like:
ga.track("my-event", my_data);
Setting up a timer shouldn't be too hard. Put that code in the routine that handles content un/loading.
Upvotes: 1