Skip to main content

Server-to-Server Integration

The server-to-server (S2S) integration sends conversion events directly from your backend to the Prisjakt API. Because no browser-side code is involved in reporting, this approach is unaffected by ad blockers, browser privacy restrictions, and Apple ITP.

Requirements

  • Your Pixel ID from Prisjakt Business Center (Integrations > Conversion Tracking).
  • Access to your backend server to perform HTTP requests to Prisjakt Click & Conversion API.

Step 1: Enable Conversion Tracking

You can skip this step if you already enabled conversion tracking, and have a Pixel ID.

  1. Log in to Prisjakt Business Center.
  2. Navigate to Integrations > Conversion Tracking.
  3. Enable Prisjakt Click ID. Your Pixel ID will appear — keep it safe.

Step 2: Capture the pjclid Parameter

When a user arrives from a Prisjakt listing, the URL contains a pjclid query parameter:

https://www.example.com/product?pjclid=239cd31f-9d43-4cb4-b8dc-2057fe18c289_1b05fa7f1c34d125

You must capture and persist this value so it can be included when the purchase is reported. There are two ways to do this:

Option A — Use the browser script for capture only.

  • Load the pjpixel browser script on the pages where traffic can land from Prisjakt - usually home, product, and promotion pages. The script handles pjclid capture automatically. You should skip the pjpixel.track step, as that will be handled by your backend.
  • At checkout, retrieve the stored values with pjpixel.getConversion() and pass clickId to your backend. For convenience, your pixelId is also returned from pjpixel.getConversion().

Option B — Capture manually.

  • On each page load, parse the URL for the pjclid parameter and save the value in a first-party cookie.
  • Retrieve it at checkout to include in the conversion request. Store it for 30 days to cover the full conversion window.

Step 3: Report the Conversion

When a purchase is completed, send a POST request from your server to the Click & Conversion API.

Endpoint

POST https://api.pj.nu/click-conversion/pixels/{pixel_id}/events

Replace {pixel_id} with your Pixel ID from Step 1.

Headers

Content-Type: application/json
Accept: application/json

Request body

{
"event_name": "purchase",
"event_time": "2024-06-15T12:30:00Z",
"external_event_id": "order-7h1k9px-r4zgm3",
"data": {
"amount": 122.95,
"currency": "EUR",
"number_of_items": 4
},
"signed_click_id": "239cd31f-9d43-4cb4-b8dc-2057fe18c289_1b05fa7f1c34d125"
}
FieldRequiredDescription
event_nameYesAlways "purchase"
event_timeNoISO 8601 UTC timestamp of the purchase. Defaults to the time the request was received.
external_event_idRecommendedYour order or transaction ID (1–100 characters). Prevents duplicate events: a second request with the same ID within 30 days returns 409 Conflict.
data.amountYesTotal transaction value. Must be between 0 and 999999999.
data.currencyYesISO 4217 code. Supported values: DKK, EUR, GBP, NOK, NZD, SEK
data.number_of_itemsNoNumber of items in the order. Must be between 0 and 999999999.
signed_click_idYesThe pjclid/clickId value captured in Step 2.

Example cURL request

curl --request POST \
--url https://api.pj.nu/click-conversion/pixels/<your-pixel-id>/events \
--header 'Content-Type: application/json' \
--data '{
"event_name": "purchase",
"event_time": "2024-06-15T12:30:00Z",
"external_event_id": "order-7h1k9px-r4zgm3",
"data": {
"amount": 122.95,
"currency": "EUR",
"number_of_items": 4
},
"signed_click_id": "239cd31f-9d43-4cb4-b8dc-2057fe18c289_1b05fa7f1c34d125"
}'

See the full API reference for all parameters, response codes, and schema details.

Testing Your Integration

Step 1: Send a test conversion

You can validate your backend integration without needing a real click from Prisjakt. Use event_name: "test-purchase" with any UUID as the signed_click_id:

curl --request POST \
--url https://api.pj.nu/click-conversion/pixels/<your-pixel-id>/events \
--header 'Content-Type: application/json' \
--data '{
"event_name": "test-purchase",
"event_time": "2024-06-15T12:30:00Z",
"external_event_id": "test-order-001",
"data": {
"amount": 100.00,
"currency": "EUR",
"number_of_items": 1
},
"signed_click_id": "52907745-7672-470e-a803-a2f8feb52944"
}'

test-purchase events accept any UUID as the signed_click_id — they do not require a signed click ID from an actual Prisjakt click. A successful request returns 201 Created.

Tip: Use a recognizable external_event_id to easily identify the test event in Business Center, and to prevent duplicate reporting if you re-send the same request.

Step 2: Confirm the event was received

Query the events endpoint filtering by event_name=test-purchase to confirm the event was stored. The endpoint requires a from/to date interval — set these to cover when you sent the test event:

curl --request GET \
--url 'https://api.pj.nu/click-conversion/pixels/<your-pixel-id>/events?event_name=test-purchase&from=2024-06-15T00:00:00Z&to=2024-06-16T00:00:00Z' \
--header 'Authorization: Bearer <your-token>'

If your event appears in the response, the full pipeline — from your server to the Prisjakt API — is working correctly.