# Lead Tracker

> Track which marketing campaign or web page generated an inbound call using the Voicenter Lead Tracker JS SDK

- **Type:** Skill
- **Install:** `agentstack add skill-voicenterteam-claude-marketplace-lead-tracker`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [VoicenterTeam](https://agentstack.voostack.com/s/voicenterteam)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [VoicenterTeam](https://github.com/VoicenterTeam)
- **Source:** https://github.com/VoicenterTeam/claude-marketplace/tree/main/plugins/voicenter-api/skills/lead-tracker

## Install

```sh
agentstack add skill-voicenterteam-claude-marketplace-lead-tracker
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

> **Language.** Reply in the user's language: detect what they write — Hebrew→Hebrew, English→English — and mirror it, switching if they switch mid-conversation. This shapes your prose, your questions, and your `AskUserQuestion` option labels only. It does **not** change the artifacts you produce — identifiers, JSON keys, BCP-47 language codes, API field names, and other data stay exactly as specified.

Help the developer integrate the **Voicenter Lead Tracker** — a JavaScript SDK that assigns dynamic phone numbers (DIDs) to website visitors to track which ad, campaign, or landing page led to each incoming call.

## When to use this skill

Use this skill when the user wants to:
- Track which Google Ads / Facebook / UTM campaign generated a phone call
- Replace a static phone number on a landing page with a dynamic tracking number
- Add a click-to-call button that is tied to a specific visitor session
- Pass Google Click ID (GCLID) or Facebook Click ID (FBCLID) to offline call conversion tracking
- Know which page or source a caller was on before they called
- Build call attribution for marketing analytics

## Environment Variables

```env
VOICENTER_LEAD_TRACKER_TOKEN=your_did_pool_token_here
# Token is provided by Voicenter and is tied to a pool of DIDs configured for your account
```

## How it works

1. Visitor lands on your page from a Google Ad / social / direct source.
2. The Lead Tracker SDK calls Voicenter and gets a **dynamic DID** (virtual number) assigned to this visitor session.
3. The DID replaces your static phone number on the page.
4. When the visitor calls the DID, Voicenter links the call to their session data (UTM params, page URL, GCLID, etc.).
5. The CDR for that call contains the visitor info in `CustomData` — you know exactly which campaign generated it.

## Setup

Add the SDK script to your HTML ``:

```html

```

Then initialize:

```javascript
VC_DID_TRACKER.init(
  'YOUR_TOKEN_FROM_VOICENTER',
  { name: 'Visitor', utm_source: 'google' },
  { text: ['.phone-number'], href: ['#call-btn'], call: ['.click-to-call'] }
);
```

## `init()` Arguments

| Argument | Type | Required | Description |
|---|---|---|---|
| `token` | String | ✅ | Token from Voicenter — maps to a pool of DIDs |
| `visitorInfo` | Object | ❌ | Any data to associate with this visitor session (name, email, UTM params, GCLID, etc.) |
| `actions` | Object | ❌ | DOM selectors to update automatically with the assigned DID |
| `actions.text` | String[] | ❌ | Selectors whose `innerText` will be replaced with the DID |
| `actions.href` | String[] | ❌ | Selectors whose `href` will be set to `tel:` |
| `actions.call` | String[] | ❌ | Selectors that trigger a `tel:` call when clicked |

## Examples

### Replace phone number text + click-to-call button

```html
03-123-4567
Call Us Now

VC_DID_TRACKER.init(
  'YOUR_TOKEN',
  { name: 'Visitor' },
  {
    text: ['.phone-display'],
    call: ['.call-btn'],
  }
);

```

### Pass UTM and click ID parameters

```javascript
const urlParams = new URLSearchParams(window.location.search);

VC_DID_TRACKER.init('YOUR_TOKEN', {
  utm_source: urlParams.get('utm_source') ?? 'direct',
  utm_campaign: urlParams.get('utm_campaign'),
  utm_medium: urlParams.get('utm_medium'),
  gclid: urlParams.get('gclid'),
  fbclid: urlParams.get('fbclid'),
  page: window.location.href,
});
```

### Get the DID programmatically (no DOM update)

```javascript
VC_DID_TRACKER.init('YOUR_TOKEN', { name: 'Visitor' })
  .then(function(did) {
    console.log('Assigned DID:', did);
    // Store in analytics, fire a custom GA event, etc.
    gtag('event', 'phone_number_shown', { did });
  });
```

### Full landing page example

```html

Landing Page

  Contact Us
  Call us: Loading...
  Click to Call
  Call Now

  
  
    const params = new URLSearchParams(window.location.search);

    VC_DID_TRACKER.init(
      'YOUR_VOICENTER_TOKEN',
      {
        utm_source: params.get('utm_source') ?? 'direct',
        utm_campaign: params.get('utm_campaign'),
        gclid: params.get('gclid'),
        page: window.location.href,
      },
      {
        text: ['.tracking-number'],
        href: ['.call-link'],
        call: ['.call-btn'],
      }
    );
  

```

## TypeScript / React Integration

```typescript
import { useEffect } from 'react';

declare const VC_DID_TRACKER: {
  init: (token: string, visitorInfo?: object, actions?: object) => Promise;
};

export function useLeadTracker(token: string) {
  useEffect(() => {
    const script = document.createElement('script');
    script.src = 'https://cdn.voicenter.co/cdn/Scripts/did_trace_worker/index.min.js';
    script.onload = () => {
      const params = new URLSearchParams(window.location.search);
      VC_DID_TRACKER.init(
        token,
        {
          utm_source: params.get('utm_source') ?? 'direct',
          utm_campaign: params.get('utm_campaign'),
          page: window.location.href,
        },
        {
          text: ['.tracking-phone'],
          href: ['.phone-link'],
        }
      );
    };
    document.body.appendChild(script);
    return () => { document.body.removeChild(script); };
  }, [token]);
}
```

## How visitor data appears in CDR

All `visitorInfo` fields are stored and associated with the call CDR. In the **CDR Notification** webhook, your UTM params, GCLID, and page URL will appear inside the `CustomData` field — enabling full offline call conversion attribution.

## Tips

- The `token` maps to a **pool of DIDs** in your Voicenter account. Each concurrent visitor on the page gets a unique DID from the pool. Contact Voicenter to configure the pool size based on your expected concurrent traffic.
- The DID is cached in **`localStorage`** so returning visitors within the DID expiry window get the same tracking number.
- Pass **`gclid`** (Google Click ID) and **`fbclid`** (Facebook Click ID) to connect offline call conversions back to your ad campaigns.
- This is entirely **client-side** — no server-side code is required.

## Related Skills

- **CDR Notification** — Receives the `visitorInfo` data in `CustomData` after the tracked call ends
- **External Layer** — Can use the DID from Lead Tracker to route calls differently per campaign

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [VoicenterTeam](https://github.com/VoicenterTeam)
- **Source:** [VoicenterTeam/claude-marketplace](https://github.com/VoicenterTeam/claude-marketplace)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-voicenterteam-claude-marketplace-lead-tracker
- Seller: https://agentstack.voostack.com/s/voicenterteam
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
