Page Views

The PageViews criteria allows you to specify an invitation to only appear after a certain number of pages have been viewed.

Pages are normally counted as calls to an Activity's onResume() method, but this can be adjusted using the following methods:

IncrementPageViews

Sometimes pages are changed in the user's experience without a change in activity, e.g., when using full-screen fragments. You can add page views manually by calling ForeSee.incrementPageViews(). For fragments, this is best done in the fragment's onResume() method:

public class YourFragment extends Fragment {

    // Your overrides, initialization code...

    @Override
    public void onResume() {
        super.onResume();

        // Increment the page views each time the fragment is shown
        ForeSee.incrementPageViews();

        // Some resume code if you like...
    }

    // The rest of your code...
}

IgnorePageViews Annotation

Adding the @IgnorePageViews annotation above your activity's class declaration tells the ForeSee® SDK to ignore calls to this activity's onResume() method as a page event:

// Don't increment page views for this activity
@IgnorePageViews
public class YourFragmentActivity extends FragmentActivity {

    // Your code here...

}

This is useful when using the incrementPageViews function mentioned above. Without this annotation, page views would be incremented once for the activity and once for the fragment, resulting in two page views for the initial view of the activity.