
WP Pixel Integration with Shoper
Warning
The plugin currently does not have active support.
In case of errors, we recommend integration via Google Tag Manager or manually adding WP Pixel codes directly to the site.
Step 1: Go to Custom Integrations
- Log in to the Shoper store admin panel.
- Navigate to: Add-ons and integrations → Custom integrations
Important!
Remember to replace the PIXEL_ID with your own Pixel ID!
The website administrator is responsible for properly embedding the WP Pixel tracking script, i.e., after the user has given consent.
The script should be embedded in its entirety, and calling the wph('go') function within it signifies the user's consent to tracking.
Withdrawing user consent should result in calling the wph('stop') function.
Step 2: Add code to the page header
In the Page header - <head> field, insert the main WP Pixel code initializing the tool.
Replace PIXEL_ID with the identifier assigned to your store.
<script>
!function(w,p,e,v,n,t,s){w['WphTrackObject'] = n;
w[n] = window[n] || function() {(w[n].queue=w[n].queue||[]).push(arguments)},
w[n].l = 1 * new Date(), w[n].v = '2.0', t=p.createElement(e), s=p.getElementsByTagName(e)[0],
t.async=1;t.src=v;s.parentNode.insertBefore(t,s)}(window,document,'script',
'https://pixel.wp.pl/w/PIXEL_ID/tr.js', 'wph');
wph('init', 'PIXEL_ID');
wph('go');
</script>
Step 3: Add event codes in the footer
In the Page footer, before closing </body> field, insert the appropriate tracking scripts, such as:
- View - page view tracking
<script> // View wph('track', 'ViewContent', { 'content_name': 'View' }) </script>
- ProductList - product list tracking
<script> // ProductList var url = document.getElementsByTagName('body')[0].getAttribute('class'); if(url.includes('shop_product_list')){ var contents = [ {products}{ id: '{products.product_id}', name: '{products.name}', category: '{products.category}', price: Number(({products.float_promo_price}).toFixed(2)) },{/products} ] if(contents.length == 0){ var contents = undefined } wph('track', 'ViewContent', { 'content_name': 'ProductList', contents: contents }) } </script>
- ViewProduct - product view tracking
<script> // ViewProduct var wph_ps = function() { var url = document.getElementsByTagName('body')[0].getAttribute('class'); if (url.includes('shop_product')) { var id_p = '{product_id}'; var name = '{name}'; var price = '{float_promo_price}'; frontAPI.getProduct(function(p) { var category = p.category.name; // do stuff wph('track', 'ViewContent', { 'content_name': 'ViewProduct', contents: [{ id: id_p, name: name, price: Number(Number(price).toFixed(2)), category: category, quantity: 1 }] }) // end stuff }, { id: id_p }); }; }; if (window.frontAPI) wph_ps(); else document.addEventListener("frontAPIReady", wph_ps, false); </script>
-
AddToCart - add to cart tracking
Version of the code if the page refreshes after adding to the cart (and possibly redirects to the cart page):<script> // AddToCart var wph_atc = function() { var button = document.getElementsByClassName('alert-success alert')[0]; if (button != undefined) { if (button.querySelector('div').innerText == "Produkt dodany do koszyka.") { frontAPI.getBasketInfo(function(p) { var product = p.products[p.products.length - 1]; wph('track', 'AddToCart', { contents: [{ "id": product.product_id.toString(), "name": product.name, "price": Number(product.price_float.toFixed(2)), "quantity": product.quantity, "category": product.category.translation.name }] }); }); }; }; }; if (window.frontAPI) wph_atc(); else document.addEventListener("frontAPIReady", wph_atc, false); </script> -
AddToCart - add to cart tracking
Version of the code if the page does not refresh and shows a confirmation message<script> // AddToCart var wph_atc = function() { var button = document.getElementsByClassName('alert-success alert')[0]; if (button != undefined) { if (button.querySelector('div').innerText == "Produkt dodany do koszyka.") { frontAPI.getBasketInfo(function(p) { var product = p.products[p.products.length - 1]; wph('track', 'AddToCart', { contents: [{ "id": product.product_id.toString(), "name": product.name, "price": Number(product.price_float.toFixed(2)), "quantity": product.quantity, "category": product.category.translation.name }] }); }); }; }; }; if (window.frontAPI) wph_atc(); else document.addEventListener("frontAPIReady", wph_atc, false); </script>
- Purchase - order confirmation tracking
<script> var contents = [ {products}{ id: '{products.product_id}', name: '{products.name}', category: '{products.category}', quantity: {products.quantity}, price: Number(({products.float_price}).toFixed(2)) },{/products} ]; if('{discount_code}' == ""){ var discount_code = undefined } else { var discount_code = '{discount_code}' } wph('track', 'Purchase', { transaction_id: '{order_id}', value_gross: Number(({float_sum_noship}).toFixed(2)), value: Number(({float_sum_noship}-{float_tax_noship}).toFixed(2)), shipping_cost: Number(({float_shipping_cost}).toFixed(2)), discount_code: discount_code, contents: contents }); </script>
Done!
WP Pixel integration has been successfully completed 🎉
In case of technical difficulties, you can use integration via GTM or ask your developer for support.
Warning
The Plugin is provided “AS IS”, WITHOUT ANY WARRANTIES, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, proper functioning, compatibility with external platforms (such as Shopify, WooCommerce, PrestaShop, or other e-commerce systems), or compatibility with other plugins. Wirtualna Polska Media S.A. does not warrant that the Plugin will be error-free, operate without interruption, or meet the User’s expectations.
TO THE MAXIMUM EXTENT PERMITTED BY LAW, WIRTUALNA POLSKA MEDIA S.A. DISCLAIMS ALL LIABILITY for any damages arising from the use of or inability to use the Plugin, including indirect, consequential, or incidental damages, loss of profits, data, or business interruption, regardless of the legal basis of the claim.
Wirtualna Polska Media S.A. may, but is not obligated to, update the Plugin. The company shall not be liable for any issues resulting from updates, changes to APIs or infrastructures of external platforms (e.g., Shopify, WooCommerce, PrestaShop, or other e-commerce systems), or interactions with other software. The User is responsible for testing the Plugin before production use and bears sole responsibility for maintaining compatibility within their environment. By using the Plugin, the User accepts these terms and assumes all risks associated with its use.
The above provisions do not exclude liability for damages caused intentionally by Wirtualna Polska Media S.A., nor in any cases where such exclusion would be contrary to mandatory provisions of law.