Add the Zalify Pixel to your site
Install the Zalify Pixel with a single script tag — including the queue stub that keeps SPA events safe.
Installing the Zalify Pixel means adding two small <script> tags to your site's <head>. This guide covers the generic install for any website. On Shopify, use the Shopify install instead — it handles consent for you.
Before you begin
You'll need your workspace ID (wid) from your Zalify dashboard. See What the Zalify Pixel does if you're not sure what the Pixel is yet.
Install the Pixel
Copy the embed snippet
This is the canonical snippet. The first script defines a small queue stub; the second loads the Pixel.
<script>
window.zalify = window.zalify || function(){(zalify.q=zalify.q||[]).push(arguments)};
</script>
<script src="https://cdn.zalify.com/pixel.js?wid=YOUR_WORKSPACE_ID" defer></script>
Add your workspace ID
Replace YOUR_WORKSPACE_ID with the wid from your Zalify dashboard.
Paste it into your site's head
Add the snippet to the <head> of every page you want to track. On most sites that means putting it in a shared layout or template so it loads site-wide.
Publish and reload
Deploy the change and open your site. The Pixel boots, fetches your workspace configuration, and starts recording page views automatically.
Keep the queue stub
The first <script> — the window.zalify queue stub — is non-negotiable for SPA frameworks. It buffers any calls made before pixel.js finishes loading so events fired during hydration aren't lost. Don't remove it or load the Pixel without it.
Include standalone landing pages
The Pixel tracks the pages it loads on, and nothing else. A page that skips your shared layout doesn't get it, so put the snippet in that page's <head> yourself. This applies to a plain HTML file served on its own, such as a file in Next.js public/, a campaign page from a page builder, or a page on another subdomain.
Landing pages are where email and ad links point. On a page without the Pixel, the visit that carries the UTMs and Zalify's email click ID is never recorded. If the visitor goes on to Shopify checkout, the order shows as Direct even though the email or ad brought them.
Orders from an email showing as Direct?
Open one of the orders and look at its conversion path. If the first visit lands straight on a /checkouts/ page with no source, the page the link pointed to has no Pixel. Add the snippet to that page.
If the page builds its own cart and sends the visitor straight to checkout, also add the landing page's utm_* and zmid parameters to the checkout URL. The order then keeps its source even when the Pixel doesn't load in time.
Tell the Pixel who converted
Page views alone can't show which ad brought a lead or a buyer. Whenever your site learns who the visitor is, on a sign-up, contact, quote, booking or audit form, or a custom checkout, identify them before the conversion event:
zalify("identify", { email, phone, firstName, lastName }); // email or phone at least
zalify("track", "lead", { form: "contact" });
On a custom checkout's thank-you page, identify with the order's email and phone, then track purchase with the order id. Without this, Zalify can only match the conversion to a visit by time, and ad platforms get a weaker match. On Shopify, orders already come in with the buyer's email; add it to your own non-Zalify forms.
Single-page apps and frameworks
The Pixel tracks route changes on its own, so you don't need to fire a page-view event yourself when the user navigates within a SPA. It works with Next.js, Remix, Vue, Svelte, and Astro out of the box.
For a framework-specific walkthrough (App Router and Pages Router), see Zalify's Next.js integration guide.
Verify it's working
Don't guess — watch events fire in real time. See Test your setup with Preview Mode.
Next steps
- Test your setup with Preview Mode — confirm events are firing
- Configure consent (GDPR/CCPA) — gate tracking on visitor consent
- Send conversions to Meta, Google, TikTok & more — turn on ad forwarding