Trigger - Page Views

The PageViews criteria allows you to specify an invite 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. One time this might happen is 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 2 page views for the initial view of the activity.

 

Other articles in this section:

  1. Trigger Overview
  2. Invite Modes
  3. Invitation API
  4. Page Views (current article)
  5. Repeat Days
  6. Sampling
  7. Multiple Measures
  8. CPP's
  9. Localization