lads_get_demographic_analytics
LinkedIn Ads read low risk
Part of the LinkedIn Demographics Agent.
What it does
Audience demographic breakdown via GET /rest/adAnalytics using a MEMBER_* pivot (MEMBER_COMPANY, MEMBER_JOB_TITLE, MEMBER_SENIORITY, MEMBER_INDUSTRY, MEMBER_COMPANY_SIZE, MEMBER_REGION_V2, MEMBER_COUNTY, MEMBER_JOB_FUNCTION, MEMBER_COUNTRY_V2, etc.; the retired V1 pivots MEMBER_REGION and MEMBER_COUNTRY are sent as MEMBER_REGION_V2 and MEMBER_COUNTRY_V2, with a warning). Returns rows per demographic bucket with impressions, clicks, costInUsd/costInLocalCurrency, landingPageClicks, oneClickLeads, externalWebsiteConversions, videoViews and videoCompletions by default. ACCURACY NOTES: forces timeGranularity=ALL for these pivots (per-day x demographic explodes the element count past 15k); LinkedIn suppresses any bucket with <3 events and retains demographic data only ~2 years. Cost fields are strings (Decimal). PRIVACY: returns member-level aggregates — usable ONLY for this report and NOT persisted, enriched, or pooled across accounts (profile-derived data must not be retained beyond 24h). Reconciles to Campaign Manager demographics.
When to use it
During a full account audit, start with lads_audit_account — it defines the checks, benchmarks, and severity rules this tool's data feeds.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pivot | enum(MEMBER_COMPANY|MEMBER_JOB_TITLE|MEMBER_SENIORITY|MEMBER_INDUSTRY|MEMBER_COMPANY_SIZE|MEMBER_REGION_V2|MEMBER_COUNTY|MEMBER_JOB_FUNCTION|MEMBER_COUNTRY_V2) | yes | Single demographic pivot (q=analytics), upper-cased; the retired V1 MEMBER_REGION and MEMBER_COUNTRY are sent as their _V2 pivots, with a warning. |
account | urn:li:sponsoredAccount|string | yes | Required: the ad account that owns the campaigns (bare id wrapped); it must be enabled for Claude. campaigns narrow the breakdown within it. |
campaigns | array<urn:li:sponsoredCampaign|int> | no | Campaign scope for the demographic breakdown. Bare ids wrapped. |
date_range | string|object | yes | Inclusive window (kept within the ~2yr demographic retention). Accepts either "YYYY-MM-DD,YYYY-MM-DD" (or a single "YYYY-MM-DD" = start only) OR the object {start:{year,month,day}[, end:{year,month,day}]}; month/day are 1-based integers. |
fields | array<string> | no | Override metric list (max 18 metrics; pivotValues and dateRange are always added and do not count). It REPLACES the default set, so list every default metric you still want. Default: pivotValues, dateRange, impressions, clicks, costInLocalCurrency, costInUsd, landingPageClicks, oneClickLeads, externalWebsiteConversions, videoViews, videoCompletions. |
top_n | int | no | Keep only the first N elements LinkedIn returns (the finder has no server-side limit). |
Safeguards
Policy
Demographic (member-derived) analytics may be used ONLY to report to the authorizing client. Per LinkedIn Data Storage Requirements: do not store member-level rows, do not use them for enrichment/prospecting/lead creation, and never commingle them across accounts; profile-derived data must not be retained beyond 24h.
Reminder
Member-level aggregates: report and discard — no persistence, enrichment, or cross-account pooling; buckets with <3 events are suppressed by LinkedIn.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_PIVOT | Pivot is not a supported MEMBER_* demographic dimension for q=analytics. | Use a supported MEMBER_* pivot. | no |
INVALID_ARGUMENT | LinkedIn rejected a parameter (surfaced verbatim), e.g. a range outside the demographic retention window. | Surface the message; correct the param (shorten the range). | no |
TOKEN_REVOKED | Token expired/revoked (HTTP 401). | Refresh once and retry; else needs_reauth. | yes |
PERMISSION_DENIED | Missing r_ads_reporting or out-of-scope account (HTTP 403). | Confirm scope and authorization. | no |
RATE_LIMITED | Daily reporting quota exceeded (HTTP 429). | Exponential backoff 5/10/20s cap 60s honoring X-RateLimit-Reset. | yes |
PLATFORM_UNAVAILABLE | LinkedIn returned a 5xx. | Retry with backoff. | yes |
Edge cases
- Buckets with <3 events are suppressed by LinkedIn — visible buckets may not sum to the account total; state this rather than imputing the gap.
- timeGranularity is forced to ALL (demographic x DAILY would breach LinkedIn's 15,000-row cap; there is no paging); an answer that reaches the cap carries a warning that it may be cut short.
- A date range beyond the 2-year demographic retention returns no or partial rows -> success; an empty answer carries a note naming the retention and the 3-event threshold.
- No demographic data (low volume, or no read access) -> success with no elements and a note: report no delivery, not zeros.
- Cost strings -> Decimal.
- Member-level rows must be dropped from any cache/log immediately after the response is returned (24h profile-data ceiling).
- Expired token -> refresh and retry once.