Skip to content
pixelary Docs

HTML snippet

Any site

Works on any site where you can edit the HTML head: hand-written sites, static site generators, and builders without a guide of their own.

You need a site key

Find it in the dashboard under Install. It looks like px_7hq2lm4x and is safe to publish. The snippets on this page use an example key: copy yours from the dashboard.

1 Add the script to every page

Paste this into the <head> of every page, or of the shared layout or template:

<head>
<script async src="https://cdn.pixelary.app/s/px_7hq2lm4x.js"></script>

async keeps the page fast: the script loads in parallel and never blocks rendering. Load it once per page. A second copy, for example from Google Tag Manager, does nothing.

2 If your code calls Pixelary early

If your own scripts call pixelary(…) before the script has loaded, add the two-line stub above it. Calls made earlier are queued and run in order once Pixelary starts.

<head>
<script>
  window.pixelary = window.pixelary || function () {
    (window.pixelary.q = window.pixelary.q || []).push(arguments);
  };
</script>
<script async src="https://cdn.pixelary.app/s/px_7hq2lm4x.js"></script>

3 Publish and verify

Publish the change and open your site. The Install page in the dashboard turns green when the first event arrives. To watch it in the browser, add ?pixelary_debug=1 to the page address: every command and event is logged to the console with the reason it was sent, held or dropped.

Domains

Pixelary accepts events only from the domains of your site in the dashboard. Add each domain the script runs on, including staging addresses you want to test from.

Content Security Policy

If your site sends a Content-Security-Policy header, allow Pixelary and the pixels you connect:

script-src  https://cdn.pixelary.app https://connect.facebook.net https://analytics.tiktok.com https://bzrcdn.openai.com
connect-src https://api.pixelary.app https://www.facebook.com https://analytics.tiktok.com https://bzr.openai.com https://bzrcdn.openai.com
img-src     https://www.facebook.com https://bzr.openai.com

EEA, UK and Switzerland

Pixelary waits for the visitor’s consent there. Without a consent banner, those visitors are not tracked. Supported banners

Something here doesn’t match what you see? Write to hello@pixelary.app.