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

# Verification

> Verify your Permutive JavaScript SDK integration is working correctly

After installing the SDK, verify that events are being tracked and data is flowing correctly.

<Tip>
  For a visual, no-code way to validate your deployment, use the [Permutive Chrome Extension](/sdks/web/javascript-sdk/troubleshooting/chrome-extension). It provides real-time visibility into event requests, cohort membership, ad targeting, and Prebid configuration directly in the browser.
</Tip>

## Quick Verification

<Steps>
  <Step title="Enable Debug Mode">
    Add `?__permutive.loggingEnabled=true` to any page URL where the SDK is installed.
  </Step>

  <Step title="Open Browser Console">
    Press F12 (or right-click > Inspect) and go to the **Console** tab.
  </Step>

  <Step title="Check for Initialization">
    Look for messages starting with `[Permutive]`:

    ```
    [Permutive] SDK initialized
    [Permutive] User ID: abc123...
    [Permutive] Pageview tracked
    ```
  </Step>

  <Step title="Verify in Dashboard">
    Log in to your Permutive dashboard and check that events appear in the Events view.
  </Step>
</Steps>

## Debug Mode

Debug mode provides detailed logging of SDK activity. Enable it by adding the query parameter to your URL:

```
https://yoursite.com/page?__permutive.loggingEnabled=true
```

Or by setting `loggingEnabled: true` in the object at the end of the tag:

```html theme={"dark"}
<script>
  !function(e,o,n,i){...}(window.permutive,"<WORKSPACE_API_KEY>","<WORKSPACE_ID>",{
    ...
	loggingEnabled: true
  });
</script>
<script async src="https://<ORGANIZATION_ID>.edge.permutive.app/<WORKSPACE_ID>-web.js"></script>
```

### Debug Output

With debug mode enabled, you'll see console messages for:

* SDK initialization status
* User ID and session information
* Events being tracked
* Cohort/segment data
* API requests and responses
* Addon initialization

Example debug output:

```
[Permutive] SDK initialized
[Permutive] User ID: 7f8e9d0c-1b2a-3c4d-5e6f-7g8h9i0j1k2l
[Permutive] Config: {apiKey: "...", workspaceId: "..."}
[Permutive] Web addon initialized
[Permutive] Tracking: Pageview {type: "article", ...}
[Permutive] Event accepted: 1/1
[Permutive] Segments: [12345, 67890, ...]
```

## Checking localStorage

The SDK stores data in localStorage. Open Developer Tools > Application > Local Storage and look for these keys:

| Key                 | Purpose                    |
| ------------------- | -------------------------- |
| `permutive-id`      | User ID                    |
| `permutive-consent` | Consent status             |
| `permutive-session` | Session data               |
| `_psegs`            | Current segments (cohorts) |
| `_pdfps`            | DFP/GAM segments           |
| `_papns`            | AppNexus segments          |
| `_prubicons`        | Rubicon segments           |

<Tip>
  Segment keys starting with `_p` contain arrays of cohort IDs that are passed to different ad platforms.
</Tip>

## Checking Network Requests

In Developer Tools > Network tab, filter by `permutive` to see SDK requests:

| Request   | Purpose         |
| --------- | --------------- |
| `live.js` | SDK script load |
| `/track`  | Event tracking  |
| `/v2.0/*` | API requests    |

### Successful Event Tracking

A successful track request shows:

* Status: `200` or `202`
* Response includes event acknowledgment

## Verification Checklist

Use this checklist to verify your integration:

<AccordionGroup>
  <Accordion title="SDK Loading" icon="download">
    * [ ] `permutive` object exists on `window`
    * [ ] `live.js` loads without errors (check Network tab)
    * [ ] No Content Security Policy errors in console
    * [ ] Debug mode shows "SDK initialized" message
  </Accordion>

  <Accordion title="User Identity" icon="user">
    * [ ] `permutive-id` key exists in localStorage
    * [ ] User ID is consistent across page loads
    * [ ] If setting identity, `identify()` call completes
  </Accordion>

  <Accordion title="Event Tracking" icon="bolt">
    * [ ] Pageview event fires on page load
    * [ ] Debug mode shows "Event accepted: 1/1"
    * [ ] Network tab shows successful `/track` requests
    * [ ] Events appear in Permutive dashboard
  </Accordion>

  <Accordion title="Cohorts/Segments" icon="users">
    * [ ] `_psegs` key exists in localStorage
    * [ ] `permutive.segments()` returns array of cohort IDs
    * [ ] Cohorts update after qualifying behavior
  </Accordion>

  <Accordion title="Ad Platform Integration" icon="rectangle-ad">
    * [ ] Platform-specific segment keys exist (e.g., `_pdfps` for GAM)
    * [ ] Ad requests include Permutive targeting
    * [ ] Debug mode shows addon initialization
  </Accordion>
</AccordionGroup>

## Console Commands

Use these commands in the browser console to verify SDK state:

```javascript theme={"dark"}
// Check if SDK is loaded
console.log('SDK loaded:', !!window.permutive);

// Get user ID
console.log('User ID:', window.permutive?.user?.());

// Get current segments
permutive.segments(function(segs) {
  console.log('All segments:', segs);
});

// Get DFP segments
permutive.segments(function(segs) {
  console.log('DFP segments:', segs);
}, 'dfp');

// Check SDK readiness
permutive.ready(function() {
  console.log('SDK is ready');
});

// Check realtime data
permutive.ready(function() {
  console.log('Realtime data ready');
}, 'realtime');
```

## Common Verification Issues

<AccordionGroup>
  <Accordion title="No debug output">
    **Problem:** Adding `?__permutive.loggingEnabled=true` shows no messages.

    **Solutions:**

    * Verify the SDK loader script is on the page
    * Check that `live.js` is loading (Network tab)
    * Look for JavaScript errors that might block SDK
    * Try clearing browser cache and reloading
  </Accordion>

  <Accordion title="Events not appearing in dashboard">
    **Problem:** Debug mode shows events accepted but nothing in dashboard.

    **Solutions:**

    * Wait a few minutes - there may be processing delay
    * Verify you're viewing the correct workspace
    * Check the event date/time filters in dashboard
    * Confirm API key matches the workspace
  </Accordion>

  <Accordion title="Empty segments array">
    **Problem:** `permutive.segments()` returns empty array.

    **Possible causes:**

    * User hasn't qualified for any cohorts yet
    * Real-time data hasn't loaded - use `ready('realtime')` callback
    * No cohorts are configured in dashboard
    * Consent not granted (if `consentRequired: true`)
  </Accordion>

  <Accordion title="User ID changes between sessions">
    **Problem:** Different user ID on each visit.

    **Possible causes:**

    * Cookies are being blocked or cleared
    * Private/incognito browsing mode
    * Cookie domain mismatch
    * Third-party cookie blocking (SDK uses first-party, so this is rare)

    **Solution:** Check localStorage persistence and cookie settings.
  </Accordion>

  <Accordion title="CORS errors">
    **Problem:** Network requests fail with CORS errors.

    **Solution:** This usually indicates a configuration issue. Contact support with:

    * Your domain
    * API key (first few characters)
    * Screenshot of the error
  </Accordion>
</AccordionGroup>

## Testing Specific Features

### Testing Pageview Tracking

```javascript theme={"dark"}
// Check if web addon is tracking
permutive.on('Pageview', function(event) {
  console.log('Pageview tracked:', event);
});

// Manually trigger a pageview (useful for SPAs)
permutive.addon('web', {
  page: { type: 'article' }
});
```

### Testing Identity

```javascript theme={"dark"}
// Set identity and verify
permutive.identify([
  { tag: 'test_id', id: 'test123' }
]);

// Check it was set (after a moment)
setTimeout(function() {
  console.log('Identity set');
}, 1000);
```

### Testing Triggers

```javascript theme={"dark"}
// Watch for segment entry
permutive.trigger(12345, 'segment', function(result) {
  console.log('Segment trigger:', result);
});

// Check segment membership
permutive.segment(12345, function(inSegment) {
  console.log('In segment 12345:', inSegment);
});
```

## Dashboard Verification

In your Permutive dashboard:

1. **Events** - Verify events are appearing with correct properties
2. **Sources** - Check your website appears as an active source
3. **Cohorts** - Verify users are qualifying for expected cohorts
4. **Activations** - Check that cohorts are being sent to ad platforms

## Production Verification

Before launching to production:

* [ ] Remove any test/debug code
* [ ] Verify `loggingEnabled: false` (or omitted) in production config
* [ ] Test on multiple browsers (Chrome, Safari, Firefox, Edge)
* [ ] Test on mobile devices
* [ ] Verify consent flow works correctly (if applicable)
* [ ] Check page load performance impact is acceptable
* [ ] Validate ad targeting is working correctly

## Getting Help

If verification fails:

1. Use the [Chrome Extension](/sdks/web/javascript-sdk/troubleshooting/chrome-extension) for a visual overview of event requests, cohort membership, and ad targeting
2. Check the [Troubleshooting Guide](/sdks/web/javascript-sdk/troubleshooting/common-errors)
3. Gather debug output and network logs
4. Contact your Customer Success Manager or [technical-services@permutive.com](mailto:technical-services@permutive.com)

## Next Steps

<CardGroup cols={2}>
  <Card title="Pageview Tracking" icon="file" href="/sdks/web/javascript-sdk/features/pageview-tracking">
    Configure pageview tracking
  </Card>

  <Card title="Event Tracking" icon="bolt" href="/sdks/web/javascript-sdk/features/event-tracking">
    Track custom events
  </Card>

  <Card title="Identity Management" icon="user" href="/sdks/web/javascript-sdk/core-concepts/identity-management">
    Set up user identity
  </Card>

  <Card title="Google Ad Manager" icon="rectangle-ad" href="/sdks/web/javascript-sdk/integrations/google-ad-manager">
    Configure ad targeting
  </Card>
</CardGroup>
