WP Pixel installation
Implementation methods
✅ Support of WP Pixel Team
WP Pixel can be implemented with the help of our technical department. Implementation with this method consists of two stages:
1. Implementation of the embed script by the client.
2. Contact the Customer Service Representative or WP Ads Support (support@ads.wp.pl) to request assistance from the Wirtualna Polska technical department in completing the remaining scripting process.
✅ Integration on the e-commerce platform using a dedicated plugin
WP Pixel can be implemented using ready-made integrations with e-commerce platforms. List of available integrations with implementation instructions
✅ Implementation scripts by the client (your development department)
- Implementation of the embed script.
- Implementation of the other key codes: e-commerce events and additional events
✅ Implementation scripts by SDK mobile apps
Wirtualna Polska has prepared a package of SDK libraries for the implementation of WP Pixel in mobile applications. Documentation for the implementation of WP Pixel using this method is available here.
✅ Implementation scripts by GTM
If you have a Google Tag Manager account associated with your website, you can add the embed script through it. Google Tag Manager (GTM) is a tag management system that allows you to quickly and easily update tracking codes and related code snippets, or tags, on your website or mobile app. Learn more here.
The embed script
Implementation on every page of the website. It is recommended that the script be placed in the <head>
or end of <body>
section.
The strings PIXEL_ID
should be replaced with the client's dedicated identifier.
Additionally, the script allows passing of additional parameters.
While user-identifying parameters are optional, providing both em
and ltid
enables the activation of campaigns in environments without third-party cookies — currently in Safari and Firefox browsers, and in the future, also in Chrome.
If you decide not to pass additional parameters, remove the , ADDITIONAL_PARAMETERS
entry from the embed script.
Default script with additional parameters
!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(), 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', ADDITIONAL_PARAMETERS);
Embedding script on your website in 3 simple steps (without additional parameters)
- Paste your own WP PIXEL_ID number into input and click OK: →
- Copy the code block
<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(), 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'); </script>
- Paste it into your HTML website source or your e-commerce implementation methods.
- Request verification. If you already have Google Analytics on your site, it is very likely that the script has been integrated correctly. However, after embedding the script, we suggest contacting your WP administrator for verification. Done!
The event codes
After implementing the embed script, proceed with the implementation of the event codes:
SPA and MPA
-
SPA (Single-Page Application): A single-page application uses only one HTML file and does not reload the page during navigation. Its entire content can be delivered at once after establishing communication with the server. Although the application still communicates with the backend (e.g., via REST API or GraphQL), it uses only the data layer and doesn't need to render views on the server. As a result, when navigating between subpages, content is displayed instantly without requiring large data transfers from the backend.
⚠️ In the source code, it's necessary to listen for route changes and trigger the Pixel event on every view change in the application.
From the user’s perspective, this type of application feels faster, smoother, and simpler. However, for WP Pixel processes, this creates a challenge: while the page content changes quickly and fluidly, WP scripts remain unchanged. Calling these scripts again can lead to duplication, which may cause repeated events or browser-side errors. Therefore, refreshing scripts in a way that avoids overlap is crucial.
⚠️ It is recommended to implement the embed script only once, and then trigger event scripts separately. Script execution must be timed with page content loading. Since we extract a lot of information from the page layout, it’s necessary to wait until the content has fully loaded. Elements pushed as JSON objects (like
dataLayer
) also often appear with a slight delay, so timing data collection with event dispatch is key.🔁 SPA does not reload the page, so:
- Scripts are loaded once.
- URL changes (routing) must be tracked manually.
- Tracking functions must be triggered on each route change –
wph('track', '.....');
- Hybrid pages exist – the site works as an MPA, but the checkout functions as an SPA.
- The main script (and any additional scripts needed for a given location) should be added when the SPA is loaded into the browser.
- On each route change, event scripts should be triggered (without reloading the main script, assuming it was embedded initially and not removed from the page).
🔧 We recommend implementation with the support of WP technical assistance.
-
MPA (Multi-Page Application): As the name suggests, multi-page applications operate based on multiple pages and multiple HTML files. The HTML content is generated by the backend, and each page transition requires a new request to the server. This also means that scripts are re-executed with each page load. The vast majority of popular e-commerce platforms are built using this model.
For the proper functioning of the WP Pixel system, script reloads are essential. Therefore, websites built with the MPA model are significantly less problematic for integration and ongoing use.
Frequently Asked Questions (FAQ)
Don't have a PIXEL_ID?
Contact your Customer Care Manager.
Data is not being collected properly or there are issues with the Pixel functioning
PIXEL_ID has not been replaced with the identifier in 2 places in the embedding script.
Browser error: 'wph is not defined'
This error occurs because the embed code is missing from the page. The "wph" object was not implemented, so calls to Pixel event functions have no reference. The embed code must always be added before any event tracking calls.