> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heypharos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pharos Pixel: track AI-referred traffic on your site

> Install the Pharos Pixel to attribute web traffic to its AI source — ChatGPT, Perplexity, Claude, Gemini, and more — without manual UTM tagging.

The Pharos Pixel is a lightweight JavaScript snippet you add to your website once. After installation, every visit to your site is automatically checked for AI referral signals, and sessions that originated from platforms like ChatGPT, Perplexity, or Claude are recorded under your brand's AI Traffic report. Unlike UTM-based attribution, the pixel detects AI referrals even when the visitor arrives without query parameters — using referrer analysis and bot-detection signals to classify each session accurately.

## Find your pixel snippet

Each brand has a unique pixel tied to its brand ID. To get yours:

<Steps>
  <Step title="Open Pixel settings">
    In the sidebar, navigate to **Settings**, then click the **Pixel** tab.
  </Step>

  <Step title="Select your brand">
    Make sure the correct brand is selected in the sidebar brand switcher. The snippet is personalized to the selected brand — using a snippet from the wrong brand will attribute traffic incorrectly.
  </Step>

  <Step title="Copy the snippet">
    Click **Copy** next to the code block. The snippet is pre-filled with your brand ID.
  </Step>
</Steps>

## Install the pixel on your website

Paste the snippet into the `<head>` section of every page on your site. Place it before the closing `</head>` tag, ideally as early as possible so it loads before other scripts.

```html theme={null}
<!-- Pharos Analytics -->
<script>
(function(w,d,s,id,bid){
  w.pharos=w.pharos||function(){(w.pharos.q=w.pharos.q||[]).push(arguments)};
  var js=d.createElement(s);js.async=1;js.id=id;
  js.src='https://cdn.pharos.ai/sdk/v1/pharos.min.js';
  js.setAttribute('data-brand-id',bid);
  var f=d.getElementsByTagName(s)[0];f.parentNode.insertBefore(js,f);
})(window,document,'script','pharos-analytics','YOUR_BRAND_ID');
</script>
<noscript><img src="https://cdn.pharos.ai/bot-detect?brand_id=YOUR_BRAND_ID&page=/" width="1" height="1" alt="" style="display:none"></noscript>
```

<Note>
  The snippet you copy from **Settings → Pixel** has your actual project URL and brand ID already filled in. Do not use the placeholder values shown above.
</Note>

The `<noscript>` beacon at the end of the snippet is an image-based fallback that captures AI bot crawls even when JavaScript is disabled. Keep both the `<script>` and `<noscript>` tags together.

### Install via Google Tag Manager

If your site uses Google Tag Manager instead of direct `<head>` edits:

<Steps>
  <Step title="Create a new tag">
    In GTM, go to **Tags → New** and choose **Custom HTML** as the tag type.
  </Step>

  <Step title="Paste the snippet">
    Paste the full Pharos snippet (including the `<noscript>` block) into the HTML field.
  </Step>

  <Step title="Set the trigger">
    Add a trigger and select **All Pages**. This ensures the pixel fires on every page view.
  </Step>

  <Step title="Publish the container">
    Submit and publish your GTM container to push the change live.
  </Step>
</Steps>

## Advanced tracking

Beyond passive attribution, the pixel exposes a `pharos()` function you can call from your own JavaScript for conversions, user identity, and cross-domain tracking.

<Tabs>
  <Tab title="Conversion tracking">
    Call `pharos('trackConversion', ...)` when a user completes an important action. Pass the event name and an optional numeric value (for revenue tracking).

    ```javascript theme={null}
    // Track a free signup
    pharos('trackConversion', 'signup', 0);

    // Track a paid purchase
    pharos('trackConversion', 'purchase', 99.99);
    ```

    Conversion events are associated with the session's original referral source, so you can see which AI platforms drive not just visits but actual outcomes.
  </Tab>

  <Tab title="User identity">
    After a user logs in or signs up, call `pharos('identify', ...)` to link the anonymous visitor session to a known user. This enables cross-session attribution — Pharos can track the full journey from an AI referral to a signup to a later purchase.

    ```javascript theme={null}
    // After login or signup
    pharos('identify', 'user_123', {
      email: 'jane@example.com',
      plan: 'pro'
    });
    ```
  </Tab>

  <Tab title="Cross-domain tracking">
    If your site spans multiple subdomains (for example, `www.yoursite.com` and `app.yoursite.com`), use `getCrossDomainLink` to carry the visitor ID across the boundary.

    ```javascript theme={null}
    // Generate a link that passes the visitor ID to the app subdomain
    const link = pharos('getCrossDomainLink', 'https://app.yoursite.com/onboard');
    // → https://app.yoursite.com/onboard?_phv=v_abc123
    ```

    Use this generated URL for any in-page links that cross subdomains.
  </Tab>
</Tabs>

## Verify your installation

After installing the pixel, confirm that it is working correctly before relying on the data.

<Steps>
  <Step title="Open the verification tool">
    Go to **Settings → Pixel** and scroll to the **Verify Installation** section.
  </Step>

  <Step title="Click Verify">
    Click the **Verify** button. Pharos checks for tracking events received from your brand in the last 24 hours.
  </Step>

  <Step title="Review the result">
    The result panel shows one of four states:

    | Status                 | Meaning                                                                       |
    | ---------------------- | ----------------------------------------------------------------------------- |
    | **Pixel verified**     | 5 or more events in the last 24 hours — the pixel is working correctly.       |
    | **Partial detection**  | Fewer than 5 events, or only bot traffic — the pixel may not be on all pages. |
    | **Pixel not detected** | No events in the last 24 hours — check the installation steps below.          |
    | **Verification error** | Pharos couldn't reach its database — try again in a moment.                   |

    If the status is partial or not detected, the panel lists specific troubleshooting steps.
  </Step>
</Steps>

<Tip>
  After installing the pixel, visit your own site from a regular browser to generate a test event. Wait a minute, then click **Verify** to confirm the event was received.
</Tip>

### Common installation issues

* **No events detected**: Confirm the snippet is in the `<head>` section of every page, not just the homepage. Open your browser's developer console and check for JavaScript errors on load.
* **Partial detection**: The pixel may be missing from some page templates. Check that your `<head>` snippet is in a shared layout component rather than individual pages.
* **CSP blocked**: If your site has a Content Security Policy, add the Pharos SDK domain to your `script-src` and `connect-src` directives.
* **Tag Manager not firing**: Verify the trigger is set to **All Pages** and that the container has been published, not just saved.

## What data the pixel collects

The pixel records the following for each visit:

* **Referrer source** — the domain or platform that sent the visitor (e.g., `chatgpt.com`, `perplexity.ai`)
* **Referrer type** — categorized as AI, organic, direct, or other
* **Page visited** — the URL of the page the visitor landed on
* **Timestamp** — when the visit occurred
* **User agent** — used for bot vs. human visitor classification

The pixel does not collect personally identifiable information unless you call `pharos('identify', ...)` explicitly.

<Info>
  To see AI traffic data after the pixel is installed, go to the **AI Traffic** page in the sidebar.
</Info>
