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

Tag managers

Fanplayr can be used with a Tag Management System. Dynamic variables must be accessible on each page and accessed by the embed code in the TMS.

For example the code you would include on your store may look like:

<script>
  window.fanplayrTms = {};
  window.fanplayrTms.pageType = 'home';
  window.fanplayrTms.productId = '';
  window.fanplayrTms.categoryId = '';
  window.fanplayrTms.productName = '';
  window.fanplayrTms.categoryName = '';
</script>

The embed code in your TMS would then look like the following:

<script>
(function(d, w, s) {
  var f = w.fanplayr = w.fanplayr || { _i:[] };
  f._i.push({
    type: 'st',
    // ...
    data: {
      version: 3,
      // ...
      pageType: window.fanplayrTms.pageType,
      categoryId: window.fanplayrTms.categoryId,
      categoryName: dow.fanplayrTms.categoryName,
      productId: window.fanplayrTms.productId,
      productName: window.fanplayrTms.productName
    }
  });
  var js = d.createElement(s);
  var fjs = d.getElementsByTagName(s)[0];
  js.async = true;
  js.src = 'https://cdn.fanplayr.com/client/production/loader.js';
  fjs.parentNode.insertBefore(js, fjs);
})(document, window, 'script');
</script>
PreviousPage cachingNextSingle page apps

Was this helpful?