登录
登录
ANA像素追踪归因分析数据分析广告管理
Z1
AI 建站
全部产品
案例服务价格关于帮助
联系我们

像素

/

2 min read

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

1

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>
2

Add your workspace ID

Replace YOUR_WORKSPACE_ID with the wid from your Zalify dashboard.

3

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.

4

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.

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

上一篇

What the Zalify Pixel does

下一篇

Install the Zalify Pixel on Shopify