Documentation
Documentation (JA)
Documentation (JA)
  • Documentation
  • Products
    • Fanplayr Targeting Portal
    • Fanplayr 360
    • PrivacyID
    • SiteSpeed
  • Features
    • Merchandising
    • Security
    • SMS
    • Web Push Notifications
      • Direct Integration Guide
      • Popup Integration Guide
      • Imaging Sizing Guide
    • Data Residency
  • Fanplayr Targeting
    • E-Commerce Integrations
      • BigCommerce
      • CommerceV3
      • Magento 1
        • Getting Started
        • Configuration
      • Magento 2
      • Miva Merchant
      • PrestaShop
      • Salesforce Commerce Cloud
      • Shopify
      • Volusion
      • VTEX
      • VTEX IO
    • Custom Integration
      • Page tracking
        • Apply to cart
        • Session offers
      • Order tracking
      • Data types
        • CartAction
        • Product
      • Data Layer API
      • Enhanced user identification
        • Manual Integration
      • Segmentation as a service
      • Lazy loading
      • Page caching
      • Tag managers
      • Single page apps
      • Custom data for verticals
        • Travel
    • Pixel Integration
    • ESP Integrations
    • Link Decoration
    • User Management
      • User Identity
      • User Properties
  • Other
    • CSP & Domains
Powered by GitBook
On this page

Was this helpful?

  1. Fanplayr Targeting
  2. Custom Integration

Lazy loading

By default Fanplayr uses asynchronous loading. Our embed code does not call Fanplayr directly, but instead writes a new JavaScript node to the DOM. This means it will stop passing of your page, and will be loaded when the browser has spare time to do so. This will always be after the DOMContentLoaded event, but may also be before the page’s OnLoad event.

If Fanplayr is loaded before your OnLoad event, this event may then not fire until Fanplayr has finished loading. This does not increase the time it takes until your page is able to be interacted with by your users, but some analytics software i.e. Google Analytics may say your page load times have increased.

To force Fanplayr to load later, we simply wrap our embed code (this should only be done for user tracking) in JavaScript that will only fire after the OnLoad event. For example:

(function(d, w, s) {
  var f = function(){
    // Embed code goes here
  };

  if (w.addEventListener) {
    w.addEventListener('load', f, false);
  } else if (w.attachEvent) {
    w.attachEvent('onload', f);
  }
})(document, window, 'script');
PreviousSegmentation as a serviceNextPage caching

Was this helpful?