Az-Alap-(Base)-Barion-Pixel-implementacioja

From Barion Documentation
Revision as of 15:01, 12 February 2020 by Eszest (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Az Alap (Base) Barion Pixel implementációja

Előkészületek

A legfontosabb dolog, amire az Alap (Base) Barion Pixel implementációjához szükséged van, az a boltod Barion Pixel ID-ja. Ezt a Pixel ID-t kell az alábbi kódba mindkét pirossal jelölt helyen beillesztened.
A Pixel ID beillesztésekor ügyelj arra, hogy a mintával azonos módon kerüljön be, tehát ne kerüljön bele esetleges extra idézőjel vagy zárójel, az egyetlen különbség a példakódtól a középső tíz és az utolsó két karakter lehet.

FONTOS
A boltod Barion Pixel ID-ját a Barion Tárcában találod. Minden bolthoz (minden egyedi POSKey-hez) külön Barion Pixel ID tartozik.
FONTOS
Minden Barion Pixel ID a következő formátumú; először a "BP" karakterek, majd tíz karakter, majd két szám, amely három csoportot kötőjelek választanak el, ahogy a példában is látszik. A hibás megadás vagy rossz formátum a Pixel hibás működését okozza.
Győződj meg róla, hogy a webshopod Barion Pixel ID-ját az alábbi példakódban található mindkét helyre beillesztetted, amiket a piros kiemelés mutat. A Barion Pixel ID eltér a próba és az éles Barion rendszereken.

Az alapkód implementációja

   
        <script>
            // Create BP element on the window
            window["bp"] = window["bp"] || function () {
                (window["bp"].q = window["bp"].q || []).push(arguments);
            };
            window["bp"].l = 1 * new Date();
    
            // Insert a script tag on the top of the head to load bp.js
            scriptElement = document.createElement("script");
            firstScript = document.getElementsByTagName("script")[0];
            scriptElement.async = true;
            scriptElement.src = 'https://pixel.barion.com/bp.js';
            firstScript.parentNode.insertBefore(scriptElement, firstScript);
      
            // Send init event
            bp('init', 'addBarionPixelId', 'BP-0000000000-00');
        </script>

        <noscript>
            <img height="1" width="1" style="display:none" alt="Barion Pixel" src="https://pixel.barion.com/a.gif?ba_pixel_id='BP-0000000000-00'&ev=contentView&noscript=1">
        </noscript>
    

Implementáció közvetlenül HTML-be

Ha közvetlen hozzáférésed van a weboldalad kódjához, azaz a megjelenített oldalak HTML kódját közvetlenül tudod szerkeszteni, illeszd az Alap (Base) Barion Pixel kódot a weboldalad '<head>' tagjébe. Ez az oldal tetején a doctype deklarációk alatt található, és az oldal metaadatait tartalmazza, mint például az oldal címe.

Minél magasabban van a kód az oldalon annál jobb, mert maga a kód minimális idő alatt lefut, mivel a Barion Pixel funkcióinak nagy része külső forrásból van betöltve aszinkron módon, tehát nem fogja akadályozni vagy lassítani az oldal működését. Emellett elengedhetetlen, hogy egyszerűen az oldalba legyen helyezve a kód, hogy az oldallal együtt töltődhessen be. Hozzájáruláskezelési szoftver alkalmazása esetén fontos, hogy ezzel a kóddal ne foglalkozzon, mivel működése a csalásmegelőzési célokhoz is szükséges.

Statikus HTML oldalak

Ha az oldalad egyetlen HTML oldalként valósul meg, esetleg külső JS vagy CSS fájlokkal kiegészítve, amit szerver oldalon nem módosítasz, vagy ilyen oldalak halmazaként létezik, egyszerűen illeszd a kódot minden kiszolgált oldal fejlécébe. Ha saját készítésű oldalad van, ami nem használ szerver oldali nyelveket vagy keretrendszereket, mint a PHP, Ruby vagy az AngularJS, valószínűleg ebbe a katágóriába tartozik.

Dynamic HTML pages

Ha az oldaladat valamilyen szerver oldali szofverrel generálod (pl. PHP, ERB, CSHTML or Jinja), vagy valamely szerveroldali nyelvvel előfeldolgozod a HTML oldalaidat, figyelj arra, hogy minden oldal fejlécébe kerüljön bele az alapkód. Erre a bevett gyakorlat egy perzisztens layout dokumentum alkalmazása, ami a minden oldalon megjelenő elemeket tartalmazza (pl. az oldalsávot vagy CSS és JS könyvtárakat), amibe a mi kódunkat is be tudod illeszteni. Ha akarod, egy betölthető aloldalt is csinálhatsz, ami szerveroldalon belekerül a layoutba, ami tartalmazza a mi kódunkat. Az egyetlen fontos dolog, hogy az összes a webshopod részeként kiszolgált HTML oldalban legyen benne a mi kódunk.

Külső szolgáltatáson keresztüli implementáció

Implementing the Base Barion Pixel is fully supported by the webshop providers UNAS (see documentation) and Shoprenter (see documentation).

We also support implementing the Base Barion Pixel through the Google Tag Manager (see documentation).

How it works

The Base Barion Pixel by itself serves two purposes. It loads the Barion Pixel code, comprised of a JS file called "bp.js" containing the functions of the Pixel and an HTML document named "barion.html" that is used for placing third-party cookies into your webpage. The other function, which is performed by the "bp" function call is to send an "init" event towards our servers which initializes the session if not already present and also tracks the page view event and some general, mostly technical data about the user. In itself, the Base Barion Pixel will not perform any marketing-related functions and it will not load any further code into your users' browser.

You can view what data the Pixel sends yourself in your browser's console. The message text after implementation is usually "Testing message", which means your Pixel has not yet been authorized to actually send any data besides the type of the event that is triggered. After Barion authorizes your Pixel to send user data, this changes to "Sending message". Below this message, the actual data that is sent or would be sent can be inspected, but in the case of the "init" event, this data is filled by the Pixel automatically.

It is also important to note that since your website and Barion have a legitimate interest in preventing payment fraud, the Base Barion Pixel should be loaded irrespective of other marketing consent management software. We will not use any data that lack marketing consent for marketing related purposes, only to combat attempts at payment fraud. This is fully compliant with the General Data Protection Regulation 2016/679 of the European Union and any other regulations that implement this nationally.