SCALIX help

← All tools

lads_get_attributed_revenue

LinkedIn Ads read low risk

Part of the LinkedIn Demographics Agent.

What it does

Revenue-attribution view via GET /rest/adAnalytics with q=attributedRevenueMetrics (available 202505+; returns the revenueAttributionMetrics object). Pivots on ACCOUNT, CAMPAIGN_GROUP, or CAMPAIGN only (up to 3 pivots, List-wrapped). REQUIRES a SINGULAR account=urn:li:sponsoredAccount:{id} filter (NOT accounts=List(...), which is rejected) and does NOT accept `timeGranularity` (both return QUERY_PARAM_NOT_ALLOWED); campaigns/campaign_groups are optional extra filters. Provides LinkedIn's view of CRM influence — return on ad spend, open/closed-won opportunities, opportunity win rate, pipeline and won revenue (USD) tied to ad spend — for accounts that have connected a CRM (Dynamics 365, Salesforce, or HubSpot). The revenueAttributionMetrics object exposes returnOnAdSpend, openOpportunities, opportunityWinRate, revenueWonInUsd, closedWonOpportunities, opportunityAmountInUsd, averageDaysToClose, and averageDealSizeInUsd. ACCURACY NOTES: revenue/pipeline come back as STRINGS (parse to Decimal); attribution is windowed/modeled by LinkedIn, so figures must be reconciled to the client CRM and the attribution methodology stated explicitly (influenced, not realized/closed); openOpportunities and opportunityAmountInUsd are only populated when dateRange.end equals today (UTC). dateRange.start is required and must be within the last year, with the window span between 30 and 366 days inclusive. This finder is NOT valid for CREATIVE or MEMBER_* pivots. Optional prior-period delta.

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

NameTypeRequiredDescription
pivotenum(ACCOUNT|CAMPAIGN_GROUP|CAMPAIGN)yesOnly ACCOUNT, CAMPAIGN_GROUP, CAMPAIGN are valid for attributedRevenueMetrics. Passed as pivots=List(...) (up to 3); MEMBER_*/CREATIVE are rejected.
accounturn:li:sponsoredAccount|intyesREQUIRED. Sent as a SINGULAR account=urn:li:sponsoredAccount:{id} (the finder rejects accounts=List(...)). Bare id is wrapped to the urn.
campaign_groupsarray<urn:li:sponsoredCampaignGroup|int>noOptional extra filter. Bare ids wrapped to urn:li:sponsoredCampaignGroup:{id} and emitted as campaignGroups=List(...).
campaignsarray<urn:li:sponsoredCampaign|int>noOptional extra filter. Bare ids wrapped and emitted as campaigns=List(...).
date_rangestring|objectyesInclusive window {start:{year,month,day},end:{...}}. start is REQUIRED and within the last year; span must be 30-366 days inclusive. When end==today (UTC), openOpportunities and opportunityAmountInUsd populate. 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.
fieldsarray<string>noOverride revenue metric projection (max 18 metrics; pivotValues and dateRange are always added and do not count); default projects revenueAttributionMetrics (returnOnAdSpend, openOpportunities, opportunityWinRate, revenueWonInUsd, closedWonOpportunities, opportunityAmountInUsd, averageDaysToClose, averageDealSizeInUsd).
include_prior_periodboolnoIf true, a second call covers the equal-length window immediately before date_range (which must be 'YYYY-MM-DD,YYYY-MM-DD') and each element gains prior_period {date_range, metrics, delta_pct} matched by pivot; a zero prior yields null, never 0.

Safeguards

Policy

Attributed-revenue data is for reporting ROI to the authorizing client only; state LinkedIn's attribution model/window clearly and reconcile to the client's CRM — never represent modeled attribution as exact closed revenue, and never pool it across accounts.

Reminder

Revenue/pipeline are modeled and string-typed — parse to Decimal, explain the attribution method, reconcile to the CRM, keep per-account isolation; openOpportunities/opportunityAmountInUsd only populate when the window ends today (UTC).

Errors

Error classMeansWhat to doRetry
MISSING_FIELDRequired field omitted (HTTP 400): q=attributedRevenueMetrics, pivots, account, or dateRange.start was not supplied.Supply q, pivots (List, ACCOUNT/CAMPAIGN_GROUP/CAMPAIGN), account=urn:li:sponsoredAccount:{id} (singular), and dateRange with a valid start.no
FINDER_NOT_SUPPORTEDq=attributedRevenueMetrics requires LinkedIn-Version >= 202505 and only ACCOUNT/CAMPAIGN_GROUP/CAMPAIGN pivots; the request used an unsupported version or pivot.Use a supported pivot and ensure the pinned version is >= 202505 (current 202606).no
REVENUE_ATTRIBUTION_NOT_CONFIGUREDNo CRM/revenue attribution source (Dynamics 365 / Salesforce / HubSpot) is connected for this account, so attributed metrics are empty.Confirm a CRM connection / Conversions API attribution is set up; report zero attributed revenue with that explicit caveat.no
INVALID_ARGUMENTLinkedIn rejected a parameter (e.g. dateRange.start outside the last year or window span not within 30-366 days) — surfaced verbatim.Surface the message; correct the param (validate the window span and start date).no
TOKEN_REVOKEDToken expired/revoked (HTTP 401).Refresh once and retry; else needs_reauth.yes
PERMISSION_DENIEDMissing r_ads_reporting or out-of-scope account (HTTP 403).Confirm scope and authorization.no
RATE_LIMITEDDaily reporting quota exceeded (HTTP 429).Exponential backoff 5/10/20s cap 60s honoring X-RateLimit-Reset.yes
PLATFORM_UNAVAILABLELinkedIn returned a 5xx.Retry with backoff.yes

Edge cases

  • No attributed revenue in the window -> success with no elements and a note (attribution needs a CRM connected through Business Manager, its data can take 72 hours to appear, and it covers the last year): report no attributed revenue, with that caveat.
  • revenueWonInUsd, opportunityAmountInUsd, averageDealSizeInUsd and similar money fields are strings -> parse to Decimal; never float-coerce money.
  • openOpportunities and opportunityAmountInUsd only return when dateRange.end is today (UTC); for historical windows they are absent — do not report them as zero.
  • dateRange.start must be within the last year and the window span must be 30-366 days inclusive, else INVALID_ARGUMENT.
  • account is required and sent singular: account=urn:li:sponsoredAccount:{id}, percent-encoded (the finder rejects accounts=List(...)).
  • Attribution is modeled and window-dependent; totals will differ from CRM closed revenue — present as influenced, not realized.
  • CREATIVE / MEMBER_* pivots are rejected by this finder -> route those to lads_run_ad_analytics with q=statistics.
  • Expired token -> refresh and retry once.
  • Cross-account ROI must keep per-account isolation; never blend unaffiliated accounts.