It is quick and simple to integrate Fanplayr into your Shopify store. Simply add the provided templates (adding your Fanplayr Account Key) in your header or footer, and your conversion script, and you're done.
Note: If you do not normally update templates yourself, please give these details to your developer. They may be using version control for the source of your website. If this is the case, updating the template using Shopify admin may lead to Fanplayr tracking being lost when your site is updated by the developer.
The user tracking script can be entered in either the header or footer of the site. We suggest putting it in the footer so your site content is loaded and there is no impact on page speed. Note that implementing it in either the header or footer should not significantly impact page speed as the Fanplayr script loads asynchronously.
Finding your theme template
Log in to your Shopify store admin area
Go to Online Store / Themes
Click the "..." and choose Edit HTML/CSS.
Choose the theme.liquid template
Add the tracking template
Add the following to your theme.liquid and save the file. We suggest adding it just before your closing </body> tag.
Note: You must replace the ACCOUNT_KEY and LOADER_URL with the information provided by Fanplayr.
The order script is added to your order complete page in your settings.
Go to Settings / Checkout
Scroll down to Order Processing and find the Additional Scripts box
Add the following script and save.
Note: You must replace the ACCOUNT_KEY and LOADER_URL with the information provided by Fanplayr. You also need to replace the STORE_DOMAIN with the domain of your store.
The order tracking will be activated as Custom Pixel.
Go to Settings / Custom Events
Click Add Custom Pixel and name it as "Fanplayr Order Tracking"
Set the permission as "Not Required"
Add the script you will find below in the Code text are
Save the new Custom Pixel
Connect the pixel to the store by clicking Connect
Note: You must replace the ACCOUNT_KEY with the information provided by Fanplayr. You also need to replace the STORE_DOMAIN with the domain of your store.
If you have a Shopify Plus account you can add the Fanplayr widget to your checkout. This helps to remind your users of any discounts that they collected during their visit, and helps them apply the discount.
Finding your theme template
Log in to your Shopify store admin area
Go to Online Store / Themes
Click the "..." and choose Edit HTML/CSS.
Choose the checkout.liquid template
Add the tracking template
Add the following to your checkout.liquid and save the file. It MUST be added just before your closing </body> tag.
Note: You must replace the ACCOUNT_KEY and LOADER_URL with the information provided by Fanplayr. You also need to replace the STORE_DOMAIN with the domain of your store.
<script>
(function(d, w, s) {
var f = w.fanplayr = w.fanplayr || { _i:[] };
var noDiscountApplied = true;
var spans = document.getElementsByTagName('span');
for ( var i in spans ) {
if ( !spans[i].getAttribute ) {
continue;
}
var attr = spans[i].getAttribute('data-checkout-discount-amount-target');
if ( attr ) {
noDiscountApplied = false;
}
}
var checkForCouponApplication = function() {
var m = window.location.hash.match(/coupon=([^&]+)/);
if ( m && m.length == 2 ) {
window.location.hash = '';
var el = document.getElementById('checkout_reduction_code');
if ( el ) {
el.value = m[1];
var btn = el.parentNode.parentNode.getElementsByTagName('button');
if ( btn.length ) {
btn[0].removeAttribute('disabled');
btn[0].click();
}
}
}
};
var couponInterval = setInterval(checkForCouponApplication, 100);
f._i.push({
version: 3,
accountKey: 'ACCOUNT_KEY',
storeDomain: 'STORE_DOMAIN',
applyToCartUrl: '#coupon=%c',
allowOfferPrompt: noDiscountApplied,
data: {
pageType: 'checkout',
currency: '{{ shop.currency }}',
cartAction: 'repeat'
}
});
var js = d.createElement(s);
var fjs = d.getElementsByTagName(s)[0];
js.async = true;
js.src = 'LOADER_URL';
fjs.parentNode.insertBefore(js, fjs);
})(document, window, 'script');
</script>