Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • JavaScript
  • PHP
  • More SDKs
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.hideFlashElement
    • FB.Canvas.scrollTo
    • FB.Canvas.setAutoGrow
    • FB.Canvas.setDoneLoading
    • FB.Canvas.setSize
    • FB.Canvas.setUrlHandler
    • FB.Canvas.showFlashElement
    • FB.Canvas.startTimer
    • FB.Canvas.stopTimer

FB.Canvas.Prefetcher.setCollectionMode

Controls how statistics are collected on resources used by your application. This method influences whether those resources are fetched to the browser early; it can also be used to turn off Prefetching completely.

This method takes one of two constants as a parameter:

  • FB.Canvas.Prefetcher.COLLECT_AUTOMATIC -- use default collection mode
  • FB.Canvas.Prefetcher.COLLECT_MANUAL -- fully manual

See the Prefetching section for an overview of this feature.

Examples

To completely control which resources are reported to Facebook, for a given page load

FB.Canvas.Prefetcher.setCollectionMode(FB.Canvas.Prefetcher.COLLECT_MANUAL);
FB.Canvas.Prefetcher.addStaticResource("http://www.mydomain.com/foo.js");
// ...

Note

It is not necessary to call setCollectionMode to call addStaticResource; in automatic mode, Facebook will automatically infer what other resources you are using that are important to fetch early.

You can use the staticresources connection on the Graph API Application object to check which usage statistics are being collected.

Updated over a year ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy