I'm testing Flurry on a simple Android开发者_如何学JAVA app that has just a single Activity.
I call the FlurryAgent.onPageView();
from the Activity's onCreate
method.
Is this the correct way to count page views?
Also, I can't find the PageView report on http://dev.flurry.com/, where is it?
Thanks, Giacomo
first, you need call to FlurryAgent.onStartSession(Context, String)
. Could be in onStar()
. Then, after that, you can call to FlurryAgent.onPageView();
. Just remember that the event onCreate
is first that onStar
According to the obfuscated code from FlurrySDK .jar
file the only thing that onPageView()
method do is increasing of static int
page view counter. So i think @Litux is right about way of usage, BUT since this field is static i think it would'nt be a good idea to use it, for example, to count number of Fragment
views, especcially if you have several Fragments
in one Activity
.
As... "Page View tracking is an optional part of the Flurry SDK that allows you to report the number of page views generated by your users for the purpose of tracking advertising. Since the definition of Page View differs for each application, the Flurry SDK cannot track these for you automatically. Instead, you need to add the appropriate integration points to track page views as they pertain to your application."
If you want to log specific Page/Activity/Fragment usage and User Paths, you need to use custom events with FlurryAgent.logEvent()
, optionally with FlurryAgent.endTimedEvent()
.
You can integrate that in Activity/Fragment onResume
, onPause
callbacks.
精彩评论