> Documentation index: https://docs.zernio.com/llms.txt. Every page is also Markdown: add .md to its URL.

# Tracking pixels

Install an ad platform's pixel or site tag on a WordPress site, and what happens when WordPress strips it.

Install an ad platform's pixel or site tag on the site with `POST /v1/accounts/{accountId}/tracking-tags/{tagId}/install`:

- `accountId` is your connected ads account (Meta, TikTok, Google, LinkedIn, Pinterest, X or OpenAI).
- `tagId` is the [tracking tag](/guides/pixels).
- The body names this site's `storeAccountId`.

Zernio adds a Custom HTML widget with the platform's base code to a widget area of the active theme.

It picks a footer area when there is one, else the first active area; pass `sidebarId` to choose.

Zernio then reads the widget back to confirm WordPress kept the `<script>` tag.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data } = await zernio.trackingtags.installTrackingTagOnStore({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', tagId: '18ce54d4x5t' },
  body: { storeAccountId: '66b2e19d8c3f5a7e9d0b1c4f', sidebarId: 'sidebar-1' }
});
```
</Tab>
<Tab value="Python">
```python
result = client.tracking_tags.install_tracking_tag_on_store(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    tag_id="18ce54d4x5t",
    store_account_id="66b2e19d8c3f5a7e9d0b1c4f",
    sidebar_id="sidebar-1",
)
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/accounts/66b2e19d8c3f5a7e9d0b1c2d/tracking-tags/18ce54d4x5t/install" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "storeAccountId": "66b2e19d8c3f5a7e9d0b1c4f", "sidebarId": "sidebar-1" }'
```
</Tab>
</Tabs>

Response (`200`), an X Pixel:

```json
{
  "platform": "xads",
  "install": {
    "storeAccountId": "66b2e19d8c3f5a7e9d0b1c4f",
    "platform": "wordpress",
    "siteUrl": "https://example.com",
    "tagPlatform": "xads",
    "siteTagId": "o8z1q",
    "installed": true,
    "method": "wordpress_widget",
    "widgetId": "custom_html-3",
    "sidebarId": "sidebar-1",
    "sidebarName": "Footer",
    "created": true,
    "homepageCheck": "found"
  }
}
```

**One widget per tag.** Each widget carries a Zernio marker naming its platform and on-site id. The install is idempotent per tag: calling it again updates (or moves) the same widget and returns `created: false`.

Tags of several platforms, or several tags of one platform, run side by side. Tag code the site owner pasted by hand is never touched.

**Homepage check.** With `verifyHomepage` (default `true`) Zernio fetches the homepage afterwards. `homepageCheck` is `found`, `not_found`, `unreachable` or `skipped`.

`not_found` can be a page cache that has not refreshed. The widget read-back is the authoritative check.

**Status.** `GET` with `?storeAccountId=` returns:

- whether this tag's widget is live (in an active widget area, script intact)
- a read-only `preflight` (`ready`, `reason` and the theme's widget areas in `sidebars`) to check a site before installing
- `tags`: every Zernio widget on the site with its `platform`, `siteTagId`, `widgetId`, `sidebarId` and whether it is `active`

The preflight reads capabilities only, so `ready: true` is not a guarantee. A stripped script is detected by the install itself.

**Uninstall.** `DELETE` with `?storeAccountId=` removes every widget Zernio created for the tag. It reports the count in `removed` (`0` when nothing was installed).

### What the widget contains

A widget holds the platform's base code, so on WordPress each tag records page views.

Storefront events such as add to cart or purchase are a [Shopify](/platforms/shopify/tracking-pixels#event-mapping) feature.

| Platform | Widget code | Official fallback |
|----------|-------------|-------------------|
| Meta | `fbevents.js`, `fbq('init')` with the pixel id, `PageView` | Meta's **Meta pixel for WordPress** plugin (`official-facebook-pixel`) |
| TikTok | TikTok's base code, `ttq.load` with the pixel code, `ttq.page()` | TikTok's **TikTok** plugin (`tiktok-for-business`, WooCommerce stores) |
| Google | The gtag.js Google tag (`gtag('config', 'AW-...')`), plus the `PAGE_VIEW` conversion snippet when the account has one | Google's **Site Kit by Google** plugin (`google-site-kit`) |
| LinkedIn | LinkedIn's Insight Tag base code (`_linkedin_partner_id`, `insight.min.js`) | Paste the tag's `code` into the theme header |
| Pinterest | Pinterest's base code, `pintrk('load')` with the tag id, `pintrk('page')` and a `pagevisit` event | The **Pinterest for WooCommerce** plugin (WooCommerce stores only) |
| X | X's `uwt.js` base code, whose `twq('config')` records the page view | Paste the tag's `code` into the theme header |
| OpenAI | OpenAI's `oaiq` base code with a `page_viewed` event | Paste the tag's `code` into the theme header |

### When WordPress cannot run the tag

WordPress keeps a `<script>` tag only for users with the `unfiltered_html` capability.

When the site cannot run the tag, Zernio removes anything it wrote and answers `422 tracking_tag_install_blocked` with the cause in `details.reason`:

| `details.reason` | Cause |
|------------------|-------|
| `insufficient_permissions` | The connected user is not an Administrator (lacks `edit_theme_options`). |
| `wordpress_com_plan` | WordPress.com strips scripts on plans without plugin support. |
| `scripts_stripped` | The site removed the script: the user lacks `unfiltered_html` (a multisite admin who is not a Super Admin), or `DISALLOW_UNFILTERED_HTML` is set. |
| `no_widget_areas` | The theme has no widget areas (block themes such as Twenty Twenty-Five use the Site Editor). |
| `widgets_api_unavailable` | The site has no widgets REST API (WordPress older than 5.8, or disabled by a security plugin). |
| `jetpack_site` | A self-hosted site connected through Jetpack with a WordPress.com login. WordPress.com does not pass widget calls to Jetpack sites: connect the site as self-hosted with an Application Password. |

```json
{
  "error": "The active theme has no widget areas (block themes use the Site Editor instead). Add the tag's code (the `code` field on GET .../tracking-tags/{tagId}) to the footer template part with a Custom HTML block, or paste the tag's code (the `code` field on GET .../tracking-tags/{tagId}) into the theme's header instead.",
  "type": "invalid_request_error",
  "code": "tracking_tag_install_blocked",
  "details": { "reason": "no_widget_areas" }
}
```

The message always names the manual alternative for the tag's platform:

- the official plugin in the table above, where one exists
- otherwise, pasting the tag's `code` (from `GET /v1/accounts/{accountId}/tracking-tags/{tagId}`) into the theme