Traffic Sources API: Get a Website's Traffic Sources

October 17, 2026
Traffic Sources API: Get a Website's Traffic Sources

Your team needs to audit where ads run, filter risky inventory, or enrich signups with web reach and channel mix. By the end of this guide, you’ll be able to call Klazify’s traffic intelligence endpoint to retrieve a site’s traffic sources, visits, engagement, and ranks, then plug those fields into your pipeline for targeting, blocking, or scoring.

Why Klazify is the best fit when you need traffic source intelligence

Traffic-source data is only actionable when it’s tied to accurate website understanding. Klazify combines domain intelligence and IAB-based categorization with traffic metrics, so you can decide not just how much traffic a site receives, but what kind of site it is and whether it aligns with your rules.

Illustration: Traffic Sources API: Get a Website's Traffic Sources
  • Accurate website categorization using AI: Klazify analyzes full-page content to map domains to precise IAB categories. When you interpret traffic sources, this context tells you if the audience is news-driven, commerce-oriented, or niche—vital for ad placement, lead enrichment, or brand safety.
  • Global coverage: Source breakdowns (e.g., search vs. social) and top-country insights help you evaluate international reach and plan geo-specific policies.
  • Real-time classification: Site content and signals change frequently; pairing up-to-date categorization with recent traffic metrics helps prevent stale allowlists/denylists.
  • Industry-level categories: IAB taxonomy lets you align traffic with advertising standards and safety models across content domains (e.g., news, entertainment, finance) without building your own ontology from scratch.
  • Simple API integration: A single REST request returns traffic ranks, engagement, sources, and country mix—easy to use in ETL, streaming, or serverless workloads.
  • Compliance and filtering: Combine category signals with traffic source composition (e.g., heavy social referral) to refine filters, block questionable sources, or prioritize review queues.

If you haven’t used Klazify before, skim the homepage for the full domain intelligence scope, then create a free account to test the traffic endpoint below.

What you’ll build: a practical pipeline for traffic source classification

This section gives you a clear, copy-pasteable path to get traffic sources, visits, engagement, and rank for a domain. You can then:

  • Block or flag domains where a specific acquisition channel dominates (e.g., overwhelming social or referral share).
  • Enrich signups with global rank and monthly visits for lead scoring.
  • Audit ad placements by country and source mix to meet geo and channel requirements.

Endpoint overview: Domain Traffic Intelligence

Use the POST endpoint to retrieve traffic signals for a given URL or domain:

POST https://www.klazify.com/api/domain_traffic_intelligence

Authentication: Bearer token in the Authorization header.

Body (JSON): {"url": "https://your-domain.com"}

The response includes (non-exhaustive):

  • global_rank
  • country_rank
  • category_rank
  • monthly_visits
  • engagement (e.g., visit duration, pages per visit, bounce rate)
  • traffic_sources (e.g., direct, search, social, referral, paid)
  • top_countries (country codes and shares)

Notes:

  • Send normalized URLs (https preferred) to avoid duplicates. Deduplicate domains such as example.com and www.example.com using a canonical rule in your pipeline.
  • If a URL is unreachable or the requestfails, you won’t be billed.
  • Use caching (e.g., 7–30 days per domain) to limit duplicate calls unless you need fresher signals.

cURL request to fetch a site’s traffic sources

Copy and run this exact cURL (replace YOUR_API_KEY):

curl -X POST "https://www.klazify.com/api/domain_traffic_intelligence" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://cbsnews.com"}'

This request returns the traffic metrics and breakdown fields described above for the provided URL.

Python example: calling the traffic endpoint and using the fields

import os
import requests
from datetime import datetime, timezone

API_KEY = os.getenv("KLAZIFY_API_KEY", "YOUR_API_KEY")
API_URL = "https://www.klazify.com/api/domain_traffic_intelligence"

def fetch_traffic(url):
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
payload = {"url": url}
resp = requests.post(API_URL, headers=headers, json=payload, timeout=30)
resp.raise_for_status()
return resp.json()

def score_domain(traffic_json):
# Example: a simple composite that favors overall reach and engagement depth.
# Customize thresholds to your business logic—do not assume specific ranges.
global_rank = traffic_json.get("global_rank")
monthly_visits = traffic_json.get("monthly_visits")
engagement = traffic_json.get("engagement", {}) or {}
pages_per_visit = engagement.get("pages_per_visit")
avg_visit_duration = engagement.get("average_visit_duration") # often seconds

# Example scoring with safe guards
score = 0.0
if isinstance(monthly_visits, (int, float)):
score += min(monthly_visits / 1_000_000, 10) # cap contribution

if isinstance(global_rank, (int, float)) and global_rank > 0:
score += 10 / (1 + global_rank / 100_000) # higher score for better rank

if isinstance(pages_per_visit, (int, float)):
score += min(pages_per_visit, 10)

if isinstance(avg_visit_duration, (int, float)):
score += min(avg_visit_duration / 60, 10) # minutes, capped

return round(score, 2)

def summarize_channels(traffic_json):
sources = traffic_json.get("traffic_sources", {}) or {}
# Expect keys like direct, search, social, referral, paid (availability may vary).
# Always check for None when integrating.
return {
"direct": sources.get("direct"),
"search": sources.get("search"),
"social": sources.get("social"),
"referral": sources.get("referral"),
"paid": sources.get("paid")
}

def main():
url = "https://cbsnews.com"
data = fetch_traffic(url)

# Example decisions:
# 1) Block if paid traffic exceeds a threshold (you define the threshold)
channels = summarize_channels(data)
paid_share = channels.get("paid")
block_for_paid_dominance = isinstance(paid_share, (int, float)) and paid_share > 0.7

# 2) Geo gating: check top countries for compliance or targeting logic
top_countries = data.get("top_countries", []) or []
primary_country = top_countries[0]["country_code"] if top_countries else None

# 3) Composite score for prioritizing review or ad allocation
site_score = score_domain(data)

print("Domain:", url)
print("Global rank:", data.get("global_rank"))
print("Country rank:", data.get("country_rank"))
print("Category rank:", data.get("category_rank"))
print("Monthly visits:", data.get("monthly_visits"))
print("Engagement:", data.get("engagement"))
print("Traffic sources:", channels)
print("Top countries:", top_countries)
print("Primary country:", primary_country)
print("Block due to paid dominance:", block_for_paid_dominance)
print("Composite score:", site_score)
print("Fetched at:", datetime.now(timezone.utc).isoformat())

if __name__ == "__main__":
main()

How to use these fields in practice:

  • global_rank, country_rank, category_rank: Use as proxies for relative popularity. Lower ranks generally imply higher popularity. Normalize or bucket them for scoring.
  • monthly_visits: Combine with rank to estimate reach. Cache it per domain with a TTL aligned to your refresh cadence.
  • engagement: Pages per visit, bounce, and visit duration help differentiate high-quality audiences from low-intent traffic. You can weight these in risk or value scores.
  • traffic_sources: Channel shares (e.g., search vs. social) let you enforce inventory policies or identify volatile sources.
  • top_countries: Enforce geo rules for compliance, language targeting, or data residency constraints.

Official categorization JSON you can reuse alongside traffic

Most pipelines pair traffic intelligence with IAB categorization for targeting, filtering, or lead enrichment. Here is the official categorization response sample you can plug into tests and data models:


{
"domain": {
"categories": [
{
"confidence": 0.92,
"name": "/Computers & Electronics/Consumer Electronics",
"IAB-632-596": "Consumer Electronics/Technology & Computing/Consumer Electronics"
},
{
"confidence": 0.89,
"name": "/Internet & Telecom/Mobile & Wireless/Mobile Phones"
}
],
"social_media": null,
"logo_url": "https://klazify.s3.amazonaws.com/2110787991611585019600ed5fb1d1300.04730104.png"
},
"success": true,
"objects": {
"company": {
"url": "https://www.apple.com/",
"name": "Apple",
"city": "Cupertino",
"stateCode": "CA",
"countryCode": "US",
"employeesRange": "100K+",
"revenue": 274515000000,
"raised": null,
"tags": [
"E-commerce",
"Consumer Electronics",
"Mobile",
"B2C"
],
"tech": [
"omniture_adobe_analytics",
"atlassian_confluence",
"successfactors",
"apache_apex",
"talend",
"oracle_peoplesoft",
"salesforce",
"stripe",
"dell_boomi_atomsphere",
"gigya",
"sage_50cloud",
"quickbooks",
"webmethods",
"apache_tomcat",
"alteryx",
"tibco_rendezvous",
"atlassian_jira",
"..."
]
}
},
"domain_registration_data": {
"domain_age_date": "1987-02-19",
"domain_age_days_ago": "13026",
"domain_expiration_date": "2030-02-20",
"domain_expiration_days_left": "123"
},
"similar_domains": [
"bestbuy.com",
"icloud.com",
"microsoft.com",
"macrumors.com",
"google.com",
"samsung.com",
"twitter.com",
"hp.com",
"bhphotovideo.com",
"dell.com"
]
}

Key fields to operationalize:

  • domain.categories: IAB-aligned topics with confidence. Use to enforce brand safety or to map into your ad-targeting taxonomy.
  • domain.logo_url: Useful for CRM enrichment, UI, and internal review tools.
  • objects.company: Company-level attributes (name, location, revenue, size, tags, tech) that are helpful for lead scoring and sales enrichment.
  • domain_registration_data: Registration age and expiration signals can factor into trust models.
  • similar_domains: Good for discovery, clustering, and competitive context.

Combine these categorization signals with traffic fields from the traffic endpoint to build more robust rules (e.g., “Only place ads on News categories with search-dominant traffic and at least N monthly visits”).

From data to decisions: mapping traffic sources to actions

Ad tech and brand safety

  • Blocklist rule: If traffic_sources.social exceeds a threshold AND the site’s IAB category is outside your allowed set, exclude it from ad placement.
  • Quality score: Favor domains with balanced traffic (e.g., search and direct) and healthy engagement (longer visit duration and more pages per visit).
  • Geo targeting: Use top_countries to restrict spend to specific markets or languages.

Content filtering and parental controls

  • High social or referral spikes can indicate volatile topics; use category plus traffic_sources to temporarily throttle exposure or queue for review.
  • Leverage category_rank within sensitive categories to calibrate stricter thresholds for smaller or unknown sites.

CRM and lead enrichment

  • monthly_visits and global_rank can feed propensity models for inbound signups; higher reach may map to higher account tiers in your CRM.
  • Map IAB categories to your internal verticals and store logo_url for reps’ quick recognition during outreach.

Cybersecurity and analytics

  • Outlier patterns (e.g., sudden shift to referral traffic) can be flagged for deeper inspection in SIEM or analytics dashboards.
  • Combine domain_registration_data with traffic volatility to prioritize new or suspicious sites for sandboxing.

Field-by-field implementation notes

  • Ranks (global_rank, country_rank, category_rank): Treat as ordinal metrics. Build buckets (e.g., top 10k, 10k–100k, etc.) instead of exact comparisons. Avoid assuming linearity across the full range.
  • monthly_visits: Count of visits over a recent period. Use it as a scale indicator; cache with a TTL that matches your refresh policy. Always check for null when integrating.
  • engagement: Typical fields include pages_per_visit, bounce_rate, and average_visit_duration (often in seconds). Normalize to a standard unit across your warehouse (e.g., convert seconds to minutes as needed).
  • traffic_sources: Store as fractional shares or percentages. Ensure your schema supports missing values. If you apply thresholds (e.g., paid > 0.7), include guard rails for None.
  • top_countries: Keep ISO country codes and share values. Use a small dimension table to map codes to names for reporting.

Batching, rate limits, and reliability

  • Batching: Fan out calls in small controlled batches and use per-domain caching. If your ingestion is high throughput, stage domains to a queue and apply concurrency limits in your worker pool.
  • Rate limits: Respect HTTP 429 or related headers when present. Add exponential backoff and jitter. Persist partially processed batches to support resumability.
  • Retries: Implement bounded retries for transient network issues. Unreachable or failed calls aren’t billed, but retries help completeness.
  • Idempotency: Normalize input URLs before requests (scheme/host canonicalization) to prevent double-fetching the same domain.

Handling unknown or new domains

  • Cold starts: For domains with sparse data, default to stricter policies (e.g., hold for review or cap exposure) until metrics are available.
  • Progressive enrichment: First call the traffic endpoint; if traffic meets your minimum thresholds, enrich with categorization to reduce total calls.
  • Fallbacks: If traffic_sources is missing or incomplete, backstop decisions with available ranks and engagement or with IAB category alone.

Mapping IAB categories to your internal taxonomy

Many teams maintain their own verticals or safety tiers. We recommend storing both the IAB category path and your internal mapped category for traceability. Keep a versioned mapping table so you can reprocess historical data when your taxonomy evolves. For categories delivered in domain.categories, align the name (e.g., “/Internet & Telecom/Mobile & Wireless/Mobile Phones”) to your own code via a deterministic mapping rule. Maintain confidence thresholds per category family if you need stricter acceptance in sensitive verticals.

Schema design and warehouse tips

  • Primary key: Use the registrable domain (e.g., example.com) as the canonical key. Store URL variants for tracebacks.
  • Partitioning: If you snapshot traffic monthly, use a date partition to support time-series analytics and anomaly detection.
  • Type safety: Represent shares as decimals (0–1). Store durations in seconds as integers and convert for display.
  • Provenance: Add columns for fetched_at (UTC ISO8601) and source (“klazify:domain_traffic_intelligence”).

Comparing traffic fields and how to apply them

Field What it tells you Common uses Cautions
global_rank Relative popularity across the web Scoring, allow/deny thresholds Use buckets; avoid assuming linear scale
country_rank Popularity within a country Geo-specific targeting and compliance Pair with top_countries for context
category_rank Popularity within content category Vertical-specific filtering and benchmarking Interpret alongside IAB category and confidence
monthly_visits Estimated reach for a recent month Lead scoring, prioritizing reviews Cache and set sensible min/max caps
engagement Visitor depth and quality signals Quality score, fraud/risk heuristics Normalize units; watch for nulls
traffic_sources Acquisition mix by channel Brand safety, ad policy enforcement Use thresholds with guard rails
top_countries Geo distribution of traffic Geo gating, localization, compliance Map ISO codes consistently

Getting started and next steps

  • Create a free account: Starter is $39.99/mo with a 7-day trial. Failed or unreachable calls are not billed.
  • Read the Documentation for authentication, payloads, and response formats.
  • Test in a staging environment, add caching, and wire alerting for non-2xx responses.

Explore more at Klazify, or use the MCP page for additional capabilities: MCP.

FAQ

  • How often should I refresh traffic data?
    It depends on your use case. Many teams cache per domain for 7–30 days and refresh popular or high-risk domains more frequently. Build a tiered refresh policy based on traffic volume or business priority.
  • What if a field like traffic_sources or engagement is missing?
    Use defensive coding. Fall back to ranks or monthly_visits when a field is null, and add rules that require multiple signals when making critical allow/deny decisions.
  • Can I map IAB categories to my custom taxonomy?
    Yes. Store the IAB category path and translate it using your own mapping table. Version your mapping so you can reprocess historical data when your taxonomy changes.
  • Do I need the categorization endpoint to use traffic intelligence?
    No—use the traffic endpoint alone if that’s all you need. Many teams call both so they can combine traffic with IAB categories for richer decisions.
  • How should I handle domains that frequently redirect?
    Resolve and store the canonical destination, then query using the canonical URL. In your datastore, maintain the original URL for traceability.

Ready to pull traffic sources and build smarter policies? Create your account now and start testing with the 7-day trial: Register. For full reference material and field descriptions, see the Documentation.

Ready to use Klazify?

Start classifying websites, enriching company data, and exploring web intelligence.

Get Started Free