Tag Management Systems
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>