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

# Verify Tracking

> Confirm that DATALYR is tracking events correctly on your site or app

After installing DATALYR, verify that events are being tracked correctly before connecting ad accounts or launching campaigns.

## Quick Verification

The fastest way to verify tracking is working:

1. Visit your website or open your app
2. Navigate to a few pages or screens
3. Go to your DATALYR dashboard
4. Click **Events** in the sidebar
5. You should see `page_view` or `app_open` events within 10 seconds

If you see events appearing in real-time, tracking is working correctly.

## Check Event Stream

The Event Stream shows all events in real-time as they come in.

### Access Event Stream

1. Go to **Dashboard → \[Your Workspace] → Events**
2. You should see a live stream of events
3. Each event shows:
   * Event name (e.g., `page_view`, `button_clicked`)
   * Timestamp
   * Visitor ID
   * Properties (click to expand)

### What to Look For

**Page views should include:**

* Page URL or path
* Referrer
* UTM parameters (if coming from an ad)
* Device and browser info
* Visitor ID

**Custom events should include:**

* Event name
* Any properties you passed
* Timestamp
* Visitor ID

## Test UTM Parameters

Test that UTM parameters are being captured correctly:

### Web Tracking

1. Create a test URL with UTM parameters:
   ```
   https://yoursite.com?utm_source=facebook&utm_medium=social&utm_campaign=test_campaign
   ```

2. Visit this URL in a new incognito/private browser window

3. Go to your DATALYR dashboard → Events

4. Find the `page_view` event and expand it

5. Verify these parameters are captured:
   * `utm_source`: facebook
   * `utm_medium`: social
   * `utm_campaign`: test\_campaign

### Mobile Tracking

For mobile apps, test deep links with UTM parameters:

```
yourapp://open?utm_source=facebook&utm_medium=paid&utm_campaign=test
```

## Test Click IDs

Test that platform click IDs are being captured:

### Facebook Click ID (fbclid)

Visit your site with a test fbclid:

```
https://yoursite.com?fbclid=test_abc123
```

Verify `fbclid` appears in the event properties.

### Google Click ID (gclid)

Visit your site with a test gclid:

```
https://yoursite.com?gclid=test_xyz789
```

Verify `gclid` appears in the event properties.

### TikTok Click ID (ttclid)

Visit your site with a test ttclid:

```
https://yoursite.com?ttclid=test_tiktok456
```

Verify `ttclid` appears in the event properties.

## Test Custom Events

If you've added custom event tracking, test those events:

### Web Custom Events

1. Trigger the action (click button, submit form, etc.)
2. Go to Events in your dashboard
3. Find your custom event by name
4. Verify all properties are correct

Example test for button click:

```javascript theme={null}
// In browser console
datalyr.track('test_button_click', {
  button_name: 'Test Button',
  location: 'testing'
});
```

Check the Events stream for `test_button_click`.

### Mobile Custom Events

Trigger the event in your app and check the dashboard:

**iOS:**

```swift theme={null}
await DatalyrSDK.shared.track("Test Event", eventData: [
    "test_property": "test_value"
])
```

**React Native:**

```typescript theme={null}
await Datalyr.track('Test Event', {
  test_property: 'test_value'
});
```

## Test User Identification

Test that user identification is working:

### Web

```javascript theme={null}
datalyr.identify('test_user_123', {
  email: 'test@example.com',
  name: 'Test User'
});
```

### Mobile

**iOS:**

```swift theme={null}
await DatalyrSDK.shared.identify("test_user_123", properties: [
    "email": "test@example.com"
])
```

**React Native:**

```typescript theme={null}
await Datalyr.identify('test_user_123', {
  email: 'test@example.com'
});
```

After calling identify, check the Events stream for an `$identify` event with the user ID and properties.

## Test Purchase Tracking

Test purchase or conversion tracking:

### Web

```javascript theme={null}
datalyr.track('purchase', {
  order_id: 'TEST_ORDER_123',
  revenue: 99.99,
  currency: 'USD'
});
```

### Mobile

**iOS:**

```swift theme={null}
await DatalyrSDK.shared.trackPurchase(
    value: 99.99,
    currency: "USD",
    productId: "test_product"
)
```

**React Native:**

```typescript theme={null}
await Datalyr.trackPurchase(99.99, 'USD', 'test_product');
```

Verify the `purchase` event appears with correct revenue amount.

## Check Browser Console

For web tracking, check the browser console for debug information:

### Enable Debug Mode

**Script Tag:**

```html theme={null}
<script
  defer
  src="https://track.datalyr.com/dl.js"
  data-workspace-id="YOUR_WORKSPACE_ID"
  data-debug="true">
</script>
```

**SDK:**

```javascript theme={null}
datalyr.init({
  workspaceId: 'YOUR_WORKSPACE_ID',
  debug: true
});
```

### Look for Console Logs

Open browser console (F12) and look for:

* `[DATALYR] Initialized`
* `[DATALYR] Event tracked: page_view`
* `[DATALYR] Event sent successfully`

If you see errors, they will appear in red.

## Check Mobile Logs

For mobile apps, check logs during development:

### iOS Debug Logs

Enable debug mode:

```swift theme={null}
let config = DatalyrConfig(
    apiKey: "dk_your_api_key",
    debug: true
)
```

Check Xcode console for:

* `[DATALYR] SDK initialized`
* `[DATALYR] Event tracked: app_open`
* `[DATALYR] Event sent successfully`

### React Native Debug Logs

Enable debug mode:

```typescript theme={null}
await Datalyr.initialize({
  apiKey: 'dk_your_api_key',
  debug: true
});
```

Check Metro console or device logs for DATALYR output.

## Check Network Requests

Verify events are being sent to DATALYR servers:

### Web

1. Open browser DevTools (F12)
2. Go to **Network** tab
3. Filter for `datalyr` or `track.datalyr.com`
4. Trigger an event (page view, button click, etc.)
5. You should see a POST request to `https://ingest.datalyr.com/events`
6. Check the request payload to see event data

### Mobile

Use network debugging tools like Charles Proxy or Proxyman to inspect requests to `https://ingest.datalyr.com`.

## Verify Visitor ID Persistence

Test that visitor IDs persist across sessions:

1. Visit your site and note the visitor ID in an event
2. Close the browser
3. Open a new browser window and revisit your site
4. Check that the visitor ID is the same

Visitor IDs should persist in cookies (web) or local storage (mobile).

## Common Issues

### No events appearing

**Check:**

* Workspace ID or API key is correct
* Script is loaded (check Network tab)
* Ad blockers are disabled
* You're viewing the correct workspace
* Events may take up to 10 seconds to appear

**Web:**

* Script is in the `<head>` section
* `defer` attribute is present

**Mobile:**

* SDK is initialized before tracking events
* Network connectivity is available
* API key starts with `dk_`

### Events appear but missing properties

**Check:**

* Properties are passed correctly to tracking calls
* Property names match what you expect
* Console for any errors or warnings

### Duplicate events

**Web:**

* Make sure tracking script is only loaded once
* Check that you're not tracking the same event multiple times

**Mobile:**

* Ensure SDK is initialized only once
* Check for duplicate tracking calls

### Wrong visitor ID

**Check:**

* Cookies are enabled (web)
* Local storage is available (mobile)
* Not testing in incognito mode (visitor IDs don't persist)

## Test Before Going Live

Before connecting ad accounts or launching campaigns:

* [ ] Page views are tracked on all pages
* [ ] UTM parameters are captured correctly
* [ ] Click IDs (fbclid, gclid, ttclid) are captured
* [ ] Custom events fire correctly
* [ ] Purchase/conversion events have correct revenue
* [ ] User identification works
* [ ] Visitor IDs persist across sessions
* [ ] Events appear in dashboard within 10 seconds
* [ ] No errors in browser console or mobile logs

## Next Steps

Once tracking is verified:

<CardGroup cols={2}>
  <Card title="Connect Ad Accounts" icon="plug" href="/integrations/overview">
    Link Meta, Google, TikTok Ads
  </Card>

  <Card title="Set Up Conversions" icon="bullseye" href="/integrations/conversion-rules">
    Define conversion events
  </Card>

  <Card title="View Dashboard" icon="chart-line" href="/features/dashboard">
    See your tracking data
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/troubleshooting/tracking-not-working">
    Fix common issues
  </Card>
</CardGroup>

## Need Help?

Still having issues with tracking? Check our [troubleshooting guide](/troubleshooting/tracking-not-working) or contact support with:

* Your workspace ID
* Browser/device you're testing on
* Any error messages from console
* Screenshot of Event Stream (if applicable)
