Tracking & attribution
Put a tracking snippet on your website so the CRM sees which pages leads visit — and which campaign actually earned the money.
Tracking & attribution
Attribution answers the hardest ads question: which campaign produced the sale, not just the click? Zodiac Tech CRM does this in two layers:
- Web tracking — a small snippet on your website records which pages each visitor sees (and links the visit to a lead once you know who they are).
- UTM capture — the campaign tags on the links that brought a lead in (
utm_source,utm_campaign, …) are stored on the lead itself and used by the Source Attribution report to credit won revenue to the campaign that earned it.
Who this is for
-
Admins — create the snippet and install it.
-
Ad specialists — verify the UTM habit across all campaign links.
-
Developers — paste the snippet and use
identify()correctly. -
Difficulty: Medium
-
Time: 12 minutes
-
Prerequisites: Admin access to the CRM; the ability to edit your website's templates (or a developer who can).
Part 1 — Create and install the snippet
1. Create a tracking snippet
- Go to Settings → Automation → Web Tracking (
/admin/tracking-snippets). - Click New, give it a name (for example Main website), and list your allowed domains (the sites permitted to send data — your production domain, and
localhostif you test there). - Save.
Expected result: the snippet appears in the list with a views counter starting at zero.
2. Get the snippet
- Use the Get snippet action on the snippet row and copy the code.
Expected result: you have a small <script> block to paste before </body> on your website (all pages you want tracked).
3. Install it
- Paste the snippet into your site's global footer/template so it loads on every page.
Expected result: the snippet loads and, on each page view, sends the page's URL, path, title, referrer and any UTM tags to the CRM. A visitor token is kept in the browser's local storage (lh_vid) so repeat visits stay linked to the same anonymous visitor. Each view becomes a PageView record.
4. Verify it works
- Open your website in a browser, visit a few pages.
- Back in the CRM, check the snippet's views counter increases.
- Open a lead's Lead 360 view → Page views section (last 20 pages the person visited).
Expected result: views count up; once a visitor is tied to a lead (see identify below or a form submission with the same visitor), their browsing appears on the lead's timeline.
Part 2 — Tie visits to known people (identify)
5. Call identify after you know who they are
- On pages where the person is known — the thank-you page after a form, a logged-in portal page — have your developer call:
window.LeadHubTracker.identify("their-email@example.com", "+9198xxxxxx");
Expected result: the CRM links that browser's anonymous session to the matching lead (email/phone). From then on, the lead's Page views show what they looked at before and after converting — invaluable for "why did they call us?".
Identify on the thank-you page The single most useful place for identify() is right after a form submission. One line there turns an anonymous visit trail into a lead's full journey.
Part 3 — UTM discipline (the attribution fuel)
6. Tag every campaign link
Every link you post (ads, WhatsApp campaigns, email footers) should carry UTM tags:
https://your-site.example/pricing?utm_source=facebook&utm_medium=cpc&utm_campaign=monsoon-offer
Expected result: when the visitor becomes a lead, the CRM stores the tags on the lead: utm_source, utm_medium, utm_campaign, utm_content, utm_term, plus landing_page and referrer_url. Meta leads keep their ad identifiers too (meta_ad_id, meta_form_id, source_id).
7. Read the attribution report
- Open Reports → Source Attribution (
/admin/source-attribution-report). - Choose a date range.
Expected result: conversions and won revenue grouped by source + campaign (utm_source + utm_campaign). A lead counts as won when its status is converted or it has a won date; revenue sums the recorded won value. This is the report to take to a budget meeting.
Expected result
You can point at a campaign and say "that brought 14 leads and two sales worth ₹X" — backed by stored UTM tags and tracked sessions, not memory.
Common mistakes
- Snippet not firing in production. Check the allowed domains list — a domain that is not listed is refused. Add
www.and non-www.variants if both serve traffic. - Missing UTMs on links. Without tags, attribution groups into "no campaign" and the report cannot credit anyone.
- Inconsistent campaign names.
Monsoon-Offer,monsoon offer,MonsoonOfferare three campaigns. Fix a naming convention and keep it. - Expecting data without consent. Tracking stores visitor sessions; make sure your site's privacy/consent practice matches what you actually run.
- Using the snippet on someone else's site. Allowed domains protect your account; requests from other domains are ignored.
Troubleshooting
| Symptom | Fix |
|---|---|
| Views stay at 0 | Snippet not installed/loading, a JavaScript error earlier on the page, or the domain is not in the allowed list. |
| Views arrive but no lead page-history | The visitor was never identify()-ed and never submitted an identified form; enter the lead's email/phone in their timeline (form submissions and inbound messages do this naturally). |
| UTM report shows a campaign twice | Name variants — standardise the naming. |
| Attribution missing for Meta leads | Ensure the lead came through the Meta pipeline so its ad identifiers are stored. |
Technical details
- Snippet management:
App\Filament\Resources\TrackingSnippetResource(Settings cluster, section Automation; nav label Web Tracking): name,allowed_domains,is_active, views counter, Get snippet action. - Collection endpoint:
App\Http\Controllers\TrackingController— the served JavaScript storeslh_vidin local storage and POSTs to/tracking/{uuid}/hitwith URL, path, title, referrer, visitor token and UTM values; each hit creates aPageViewrow.window.LeadHubTracker.identify(email, phone)links the session to the person. - Lead attribution fields:
utm_source,utm_medium,utm_campaign,utm_content,utm_term,landing_page,referrer_url,meta_ad_id,meta_form_id,source_id. - Reporting:
App\Filament\Pages\SourceAttributionReport— groups by utm_source + utm_campaign; won =status = 'converted'ORwon_at IS NOT NULL; revenue =SUM(won_value).
Related guides
- Reports — the full report catalogue.
- Meta lead capture pipeline — where Meta identifiers are attached.
- Campaigns — the campaigns attribution measures.
- Lead 360 view — where a lead's page history is shown.
Was this page helpful?
Thanks — noted. ✦