Implementing the Base Barion Pixel

From Barion Documentation
Jump to navigation Jump to search

Implementing the Base Barion Pixel

Getting Ready

The first prerequisite to implement the Base Barion Pixel irrespective of your webshop is knowing your your Barion Pixel ID.

Afterwards, the exact details differ based on the platform that your webshop uses.

Static HTML page

If your site is served as a sigle HTML page or a collection of HTML pages with no server side templating, paste the Base Barion Pixel code as follows into the `<head>` tag of your website. The higher it is in the page markup, the better, since our code takes a minimal time to run, as the majority of Barion Pixel functions are loaded from an external source, which loads asynctronously, so that it won't block your page from loading or cause slowdowns.

Implementation of the base code

   
        <script>
            (function(i,s,o,g,r,a,m){i['BarionAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window, document, 'script', 'https://pixel.barion.com/bp.js', 'bp');

            // send page view event
            bp('init', 'addBarionPixelId', 'BP-0000000000-00');
        </script>

        <noscript>
            <img height="1" width="1" style="display:none" src="https://pixel.barion.com/a.gif?__ba_pixel_id='BP-0000000000-00'&ev=contentView&noscript=1"/>
        </noscript>
    
IMPORTANT
Be sure to insert your unique Barion Pixel ID at both locations in the provided code example, marked by a red outline. Always double check your Barion Pixel ID. The Barion Pixel ID is different in the sandbox and live Barion systems.