Page caching

If you have your store caches page requests then you may have to make a second call to Fanplayr to get the correct data for the specific user. Items such as page type, category etc. can be send through with this cached request, although data such as cart items and subtotals may change with each request. Both PrestaShop and Magento use Full Page Caching and our implementations of extensions for these shops do a request to a local service which sends back the real embed code. For example:

(function(d, w, s) {
  var js = d.createElement(s), fjs  = d.getElementsByTagName(s)[0]; js.async = true;
  js.src   = 'https://mystore.com/fanplayr/ajax/getEmbedJs/'
    + '?pageType=home&productId=&categoryId=&productName=&categoryName=&'
    + (new Date().getTime());
  fjs.parentNode.insertBefore(js, fjs);
})(document, window, 'script');

Note that page type, product ID, category ID, product name and category name are sent through on this request and a OK to be cached as they do not change with each request.