Skip to main content

Browser Script Integration

The browser script captures the pjclid parameter automatically when users arrive from Prisjakt, and sends conversion events from the visitor's browser when a purchase is completed.

Requirements

  • Access to your website's codebase
  • Your Pixel ID from Prisjakt Business Center (Integrations > Conversion Tracking)

Step 1: Install the Script

Add the following to the <head> of every landing page, product page, and order confirmation page. Replace <YOUR PIXEL ID> with your Pixel ID from Business Center.

<head>
<script async src="https://cdn.pji.nu/libs/pjpixel/pjpixel.min.js"></script>
<script>
window.addEventListener('load', function () {
pjpixel.init('<YOUR PIXEL ID>');
});
</script>
</head>
New Zealand shops

Load the pixel from the New Zealand CDN for better performance:

https://cdn.pricespy.co.nz/libs/pjpixel/pjpixel.min.js

Step 2: Track Purchases

On your order confirmation page, send order information with pjpixel.track, once the purchase is complete:

pjpixel.track('purchase', { amount: 5550, currency: 'SEK', numberOfItems: 3 }, { eventId: '7h1k9px-r4zgm3' });
ParameterRequiredDescription
amountYesTotal transaction value. Must be between 0 and 999999999.
currencyYesISO 4217 currency code. Supported values: DKK, EUR, GBP, NOK, NZD, SEK
numberOfItemsNoNumber of items in the basket. Must be between 0 and 999999999.
eventIdRecommendedYour order or transaction ID (max 100 characters). Prevents duplicate reporting — if the same eventId is submitted twice, only the first is recorded.

See the interface reference for full API details.

Testing Your Integration

Step 1: Check that the script is loaded

Open your browser's developer tools and type pjpixel in the console. It should return an object with a few methods:

> pjpixel
{clear: ƒ, getConversion: ƒ, init: ƒ, track: ƒ}

Troubleshooting: If pjpixel is not available, verify that you have included the script tag correctly and that there are no JavaScript errors in the console.

Step 2: Send a test conversion

You can validate that your pixel is set up correctly without needing a real click from Prisjakt. Load your order confirmation page with any UUID as the pjclid query parameter:

https://www.example.com/order-confirmation?pjclid=52907745-7672-470e-a803-a2f8feb52944

Then call pjpixel.track with the 'test-purchase' event name:

pjpixel.track('test-purchase', { amount: 100, currency: 'SEK', numberOfItems: 1 }, { eventId: 'test-001' });

test-purchase events accept any UUID as the click ID — they do not require a signed click ID from an actual Prisjakt click.

Tip: Use a recognizable eventId to easily identify the test event in Business Center, and to prevent duplicate reporting if you reload the page.

Content Security Policy

If your site uses a Content Security Policy, add https://api.pj.nu to your connect-src directive so the pixel can reach the Prisjakt API:

Content-Security-Policy: connect-src 'self' https://api.pj.nu;

If a user revokes tracking consent, call pjpixel.clear() to remove any stored pjclid data from their browser:

pjpixel.clear();