Dokumentacja integracji
Jeden endpoint, dwa modele rozliczenia. Tracking WebePartners działa przez lekki snippet JS i nie wymaga żadnego backendu po stronie sklepu.
Wprowadzenie #
Snippet webe.js wczytywany jest na każdej stronie sklepu. Automatycznie identyfikuje użytkownika który trafił przez link afiliacyjny, a po dokonaniu konwersji wysyła request do jednego endpointu:
Ten sam endpoint obsługuje oba modele rozliczenia — typ konwersji określa parametr type:
CPS type=cps — zamówienie (wartość domyślna, można pominąć)
CPL type=cpl — lead / formularz / rejestracja
Do działania potrzebujesz ID serwisu (MID) — otrzymasz go od opiekuna WebePartners.
1 Instalacja snippetu #
Wklej poniższy kod w sekcji <head> na każdej stronie sklepu. Zastąp TWOJE_MID swoim ID serwisu.
<script
src="https://webeh1.com/webe.js"
data-webe-mid="TWOJE_MID"
async
></script>
Atrybut data-webe-mid identyfikuje Twój serwis. Atrybut async gwarantuje nieblokujące ładowanie.
Endpoint API #
Snippet wywołuje jeden endpoint dla obu typów konwersji:
Parametry query string
| Parametr | Typ | Wymagany | Domyślnie | Opis |
|---|---|---|---|---|
mid |
int | TAK | — | ID serwisu (MID) |
refer |
string | TAK | — | Numer / ID zamówienia lub leadu |
type |
string | nie | cps | Model konwersji: cps lub cpl |
sum |
decimal | nie | — | Wartość brutto konwersji bez kosztów wysyłki (wymagane dla CPS, opcjonalne dla CPL) |
dc |
string | nie | — | Użyty kod rabatowy |
visitoruid |
string | nie | — | UID odwiedzającego z ciasteczka webe_vuid — snippet uzupełnia automatycznie |
visitoruid jest uzupełniany przez snippet automatycznie z ciasteczka webe_vuid. Nie musisz go przekazywać ręcznie w kodzie strony.
2 Event zamówienia CPS #
Na stronie podziękowania za zamówienie wywołaj window.__webe.order(). Snippet musi być już załadowany — stąd używamy window.load.
<script>
window.addEventListener('load', async function () {
await window.__webe.order({
type: 'cps', // model konwersji — wymagany
refer: 'TX-9912', // numer zamówienia — wymagany
sum: 599.00, // wartość brutto bez wysyłki — wymagany
dc: 'KOD20', // kod rabatowy — opcjonalny
});
});
</script>
Parametry
| Parametr | Typ | Wymagany | Opis |
|---|---|---|---|
type | string | TAK | Model konwersji — wartość stała: cps |
refer | string | TAK | Numer lub ID zamówienia ze sklepu |
sum | number | TAK | Wartość brutto zamówienia bez kosztów wysyłki |
dc | string | nie | Użyty kod rabatowy |
Snippet automatycznie dodaje mid oraz visitoruid przed wysłaniem requestu.
refer i sum muszą być dynamicznie podstawiane przez backend sklepu — nie wpisuj ich na stałe w szablonie.
2 Event leadu CPL #
Jeśli serwis rozlicza się w modelu CPL (np. wypełnienie formularza, rejestracja), wywołaj window.__webe.lead() na stronie potwierdzenia. Snippet wyśle request z type=cpl.
<script>
window.addEventListener('load', async function () {
await window.__webe.lead({
type: 'cpl', // model konwersji — wymagany
refer: 'LEAD-4421', // ID leadu / zgłoszenia — wymagany
sum: 49.00, // wartość leadu — opcjonalny
dc: 'KOD20', // kod rabatowy / kampania — opcjonalny
});
});
</script>
Parametry
| Parametr | Typ | Wymagany | Opis |
|---|---|---|---|
type | string | TAK | Model konwersji — wartość stała: cpl |
refer | string | TAK | Unikalny identyfikator leadu / zgłoszenia |
sum | number | nie | Wartość leadu, jeśli jest znana |
dc | string | nie | Kod kampanii lub rabatowy |
Snippet automatycznie dodaje mid oraz visitoruid przed wysłaniem requestu.
WooCommerce #
Dodaj poniższy kod do functions.php aktywnego motywu lub wtyczki.
CPS — zamówienie
add_action('woocommerce_thankyou', function ($order_id) {
$order = wc_get_order($order_id);
?>
<script>
window.addEventListener('load', async function () {
await window.__webe.order({
type: 'cps',
refer: '<?= esc_js($order->get_order_number()) ?>',
sum: <?= (float) $order->get_total() ?>,
dc: '<?= esc_js(implode(',', $order->get_coupon_codes())) ?>',
});
});
</script>
<?php
});
CPL — lead / rejestracja
// Przykład: po pomyślnej rejestracji użytkownika
add_action('user_register', function ($user_id) {
?>
<script>
window.addEventListener('load', async function () {
await window.__webe.lead({
type: 'cpl',
refer: '<?= esc_js($user_id) ?>',
});
});
</script>
<?php
});
PrestaShop #
Wklej snippet w szablonie strony podziękowania order-confirmation.tpl.
CPS — zamówienie
<script>
window.addEventListener('load', async function () {
await window.__webe.order({
type: 'cps',
refer: '{$order.reference}',
sum: {$order.total_paid},
dc: '{$order.discount_name|default:""}',
});
});
</script>
CPL — lead / formularz
<script>
window.addEventListener('load', async function () {
await window.__webe.lead({
type: 'cpl',
refer: '{$customer.id}',
dc: '{$campaign_code|default:""}',
});
});
</script>
Shoper / inne platformy #
Wklej snippet JS w sekcji „Kod na stronie podziękowania" w ustawieniach sklepu, podstawiając odpowiednie zmienne szablonu.
| Parametr JS | Shoper | IdoSell |
|---|---|---|
refer | {order.id} | {order_id} |
sum | {order.total} | {order_total} |
dc | {order.discount_code} | {discount_code} |
Dla modelu CPL wywołaj window.__webe.lead() zamiast window.__webe.order() i zawsze przekazuj type: 'cpl'. Parametr sum jest opcjonalny — podaj go jeśli wartość leadu jest znana. Dla innych platform skonsultuj dokumentację — szukaj zmiennych odpowiadających numerowi zamówienia i wartości koszyka.
Testowanie #
Po wdrożeniu złóż testowe zamówienie / wypełnij formularz i otwórz DevTools → Network. Na stronie podziękowania powinien pojawić się request do:
CPS
CPL
Status 200 = konwersja zarejestrowana poprawnie
Jeśli request nie pojawia się — upewnij się że snippet jest wczytany w sekcji <head> i że TWOJE_MID zostało zastąpione właściwym ID serwisu.
Integration Documentation
One endpoint, two commission models. WebePartners tracking runs through a lightweight JS snippet with no backend changes required on your store.
Introduction #
The webe.js snippet is loaded on every page of your store. It automatically identifies users who arrived via an affiliate link and, after a conversion, sends a request to a single endpoint:
The same endpoint handles both commission models — the conversion type is set via the type parameter:
CPS type=cps — order (default value, can be omitted)
CPL type=cpl — lead / form submission / registration
You will need a Service ID (MID) — your WebePartners account manager will provide it.
1 Snippet installation #
Paste the code below into the <head> section of every page of your store. Replace YOUR_MID with your Service ID.
<script
src="https://webeh1.com/webe.js"
data-webe-mid="YOUR_MID"
async
></script>
The data-webe-mid attribute identifies your service. The async attribute ensures the snippet loads without blocking page rendering.
API endpoint #
The snippet calls a single endpoint for both conversion types:
Query string parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
mid |
int | YES | — | Service ID (MID) |
refer |
string | YES | — | Order number / ID or lead ID |
type |
string | no | cps | Conversion model: cps or cpl |
sum |
decimal | no | — | Gross conversion value excl. shipping (required for CPS, optional for CPL) |
dc |
string | no | — | Discount code used by the customer |
visitoruid |
string | no | — | Visitor UID from the webe_vuid cookie — appended automatically by the snippet |
visitoruid parameter is appended automatically by the snippet from the webe_vuid cookie. You do not need to pass it manually in your page code.
2 Order event CPS #
On the order thank-you page, call window.__webe.order(). The snippet must already be loaded — which is why we use the window.load event.
<script>
window.addEventListener('load', async function () {
await window.__webe.order({
type: 'cps', // conversion model — required
refer: 'TX-9912', // order number — required
sum: 599.00, // gross value excl. shipping — required
dc: 'CODE20', // discount code — optional
});
});
</script>
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | YES | Conversion model — fixed value: cps |
refer | string | YES | Order number or ID from your store |
sum | number | YES | Gross order value excluding shipping costs |
dc | string | no | Discount code used by the customer |
The snippet automatically appends mid and visitoruid before sending the request.
refer and sum values must be injected dynamically by your store's backend — never hardcode them in the template.
2 Lead event CPL #
If your service uses the CPL model (e.g. form submission, sign-up, registration), call window.__webe.lead() on the confirmation page. The snippet will send the request with type=cpl.
<script>
window.addEventListener('load', async function () {
await window.__webe.lead({
type: 'cpl', // conversion model — required
refer: 'LEAD-4421', // lead / submission ID — required
sum: 49.00, // lead value, if known — optional
dc: 'CODE20', // campaign or discount code — optional
});
});
</script>
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | YES | Conversion model — fixed value: cpl |
refer | string | YES | Unique identifier of the lead or submission |
sum | number | no | Lead value, if known |
dc | string | no | Campaign or discount code |
The snippet automatically appends mid and visitoruid before sending the request.
WooCommerce #
Add the code below to the functions.php file of your active theme or plugin.
CPS — order
add_action('woocommerce_thankyou', function ($order_id) {
$order = wc_get_order($order_id);
?>
<script>
window.addEventListener('load', async function () {
await window.__webe.order({
type: 'cps',
refer: '<?= esc_js($order->get_order_number()) ?>',
sum: <?= (float) $order->get_total() ?>,
dc: '<?= esc_js(implode(',', $order->get_coupon_codes())) ?>',
});
});
</script>
<?php
});
CPL — lead / registration
// Example: fire after successful user registration
add_action('user_register', function ($user_id) {
?>
<script>
window.addEventListener('load', async function () {
await window.__webe.lead({
type: 'cpl',
refer: '<?= esc_js($user_id) ?>',
});
});
</script>
<?php
});
PrestaShop #
Insert the snippet in the order confirmation template order-confirmation.tpl.
CPS — order
<script>
window.addEventListener('load', async function () {
await window.__webe.order({
type: 'cps',
refer: '{$order.reference}',
sum: {$order.total_paid},
dc: '{$order.discount_name|default:""}',
});
});
</script>
CPL — lead / form
<script>
window.addEventListener('load', async function () {
await window.__webe.lead({
type: 'cpl',
refer: '{$customer.id}',
dc: '{$campaign_code|default:""}',
});
});
</script>
Shoper / other platforms #
Paste the JS snippet in the "Thank-you page code" section of your store settings, substituting the appropriate template variables.
| JS parameter | Shoper | IdoSell |
|---|---|---|
refer | {order.id} | {order_id} |
sum | {order.total} | {order_total} |
dc | {order.discount_code} | {discount_code} |
For the CPL model, call window.__webe.lead() instead of window.__webe.order() and always pass type: 'cpl'. The sum parameter is optional — include it if the lead value is known. For other platforms, consult their documentation and look for variables matching the order number and cart value.
Testing #
After deployment, place a test order or submit a test form, then open DevTools → Network. The following request should appear on the confirmation page:
CPS
CPL
Status 200 = conversion recorded successfully
If the request does not appear, verify that the snippet is loaded in the <head> section and that YOUR_MID has been replaced with the correct Service ID.