Jepto
Developer Docs
Developer docs

Data Model

How a client's catalog of metrics and dimensions is built, how fields roll up, unified and custom fields, how a query runs, and the schema response.

The data model is the catalog of every metric and dimension a client can query. Jepto builds it per client from the sources connected to that client, adds unified fields that span ad platforms and your custom fields, and uses it to check, route and calculate every query. The same data model serves the REST and GraphQL APIs, Jepto MCP and Jepto’s own reports, so a field means the same thing everywhere.

1Platform fieldsFrom each connected source
2Unified fieldsOne field across ad platforms
3Custom fieldsFormulas you define
4Data modelOne catalog per client

What’s in a client’s data model

LayerField namesWhere it comes from
Platform fieldsgoogleAds.campaignName, googleAnalytics4.sessionsEach connected source contributes its own fields. Jepto defines them per platform, with labels, types, formats and aggregations.
Entity fieldsaiVisibility.answers.platformSources with several kinds of record (entities) prefix the entity: {source}.{entity}.{field}
BigQuery fieldsbigQuery.a1b2c3d4e5f6a7b8.order_totalColumns of a BigQuery table connected as a data source: bigQuery.{id}.{column}, where {id} identifies the table. Column names keep their original spelling.
Unified fieldsunified.spend, unified.sourceJepto fields that map to the matching field on each ad platform. Present when the client has more than one source, or has custom fields.
Custom fieldscustom_a1b2c3d4e5f6a7b8Formulas defined in your Jepto account, either account-wide or for one client

The data model only contains fields the client can actually query. Connect a source and its fields appear; disconnect it and they go.

Source keys

KeyPlatform
googleAdsGoogle Ads
facebookAdsMeta (Facebook) Ads
instagramAdsInstagram Ads
googleAnalytics4Google Analytics 4
googleSearchConsoleGoogle Search Console
googleBusinessProfileGoogle Business Profile
microsoftAdsMicrosoft Advertising
linkedInAdsLinkedIn Ads
tiktokAdsTikTok Ads
twitterAdsX (Twitter) Ads
shopifyShopify
xeroXero
aiVisibilityJepto AI Visibility
unifiedCross-platform fields
bigQueryGoogle BigQuery tables you connect

Account-wide data model

Read the schema with clientId: "all_clients" to get the account-wide data model. It’s the union of every client’s data model, not the fields all clients share:

IncludesDetail
Every source type connected to any clientIf one client has TikTok Ads, TikTok fields are listed
Unified fieldsWhen the account has more than one source type
Account-wide custom fieldsAvailable to every client
Every client’s own custom fieldsListed even though only that client can query them

The response doesn’t say which clients have each field. A field in the account-wide data model may not exist for a particular client, so read that client’s schema before querying it. Use the account-wide data model to build field pickers, documentation or mappings across clients.

"all_clients" is for reading the schema only. Data queries always run for one client: POST /query and analyticsQuery reject "all_clients" with INVALID_REQUEST. For several clients, list them with GET /clients and send one query per client.

‍

Metrics and dimensions

  • Metrics (kind: "metric") are numbers. They go in measures, and each knows how to combine across rows.
  • Dimensions (kind: "dimension") are values to group and filter by. They go in dimensions and filters.
  • Date dimensions: each source has one date field, usually {source}.date, with isDefaultDateField: true. It goes in timeDimensions, never in dimensions.

Aggregation

Rolling up is a property of the field, not of the query. When a query groups rows (by campaign, by week, or into one total), each metric combines its values with its aggregation:

ValueCombines rows byTypical fields
sumAdding valuesSpend, clicks, impressions, conversions
avgAveraging valuesValues that are already rates, with no formula to recalculate them
minSmallest valueFirst-seen dates, minimum bids
maxLargest valueReach-style metrics that can’t be added up
countCounting non-null valuesRecord counts
count_distinctCounting distinct valuesUnique IDs

Override a metric’s aggregation for one query with measureAggregations. See Data Queries.

Period rollups

Some metrics can’t be combined by a simple aggregation. Adding up daily CTRs gives the wrong answer, and so does adding up daily unique users. These metrics have a periodRollup that tells Jepto how to build the value for any period:

periodRollupHow the value is builtExample
formulaRecalculated after aggregation from its component metrics, using formulagoogleAds.ctr = clicks ÷ impressions, over the whole period
weightedAverageAveraged across rows, weighted by the metric named in weightedByAverage position weighted by impressions
apiPeriodRequested from the platform for each period, because the platform deduplicates across daysgoogleAnalytics4.totalUsers by month
  • Metrics with a periodRollup can’t take a measureAggregations override.
  • An apiPeriod metric needs one platform request per time bucket, up to 36 per query. A year of weekly buckets (52) is rejected; use month or a shorter range.

Date grain

dateGrain is the finest period a metric is stored at. A metric stored by month can be bucketed by month, quarter or year, but not by day or week. Distinct-count metrics must be bucketed at exactly their grain.

‍

Unified fields

A unified field reads the matching field on every platform that has one, then combines them with the field’s own rollup. unified.spend reads Cost on Google Ads, Amount spent on Meta and Spend on TikTok and adds them up. Group by unified.source to get one row per platform, and use unified.date as the time dimension.

  • Spend, impressions, reach, clicks, CTR, CPM, CPC and frequency map to every ad platform.
  • Conversions, cost per conversion, view-through conversions, conversion value and ROAS don’t map to Meta. A platform with no mapping contributes no rows for that field.
  • A unified ratio such as unified.ctr only includes platforms that map every input of its formula, so a platform never contributes one side of a ratio.
  • Each unified field’s dataSources lists exactly which platforms it reads for this client.

Custom fields

Custom fields are formulas over other fields, such as blended ROAS or spend after fees. You define them in Jepto; through the API you query them like any other field by their custom_{id} name, and Jepto expands the formula before running the query.

  • They have isCustomField: true and keep their bare custom_{id} name, with no source prefix.
  • An account-wide custom field appears in every client’s data model; a client custom field only in that client’s.
  • A custom field can only be queried with the sources its formula uses. Querying it against other sources returns INVALID_QUERY.
  • Metric custom fields go in measures; they can’t be used as dimensions.

‍

How a query runs

Every query, from the API, Jepto MCP or a report card, goes through the same steps:

StepWhat happens
1. CheckEvery field, operator, token and granularity is checked against the client’s data model and the query rules. Anything unknown is rejected before data is fetched.
2. Resolve datesRelative tokens such as lastMonth become dates in the query’s timezone.
3. Expand custom fieldsEach custom_{id} field is replaced by its formula over platform fields.
4. RouteField names are grouped by source prefix. Unified fields fan out to every platform they map to.
5. Result cacheIf the same query ran in the last 12 hours, its result is returned straight away.
6. Fetch rowsEach source returns rows for the date range. Date spans already fetched are read from Jepto’s row cache; only missing spans are requested from the platform.
7. CombineRows from all sources are stacked (a union, not a join), dimension filters applied, rows grouped by your dimensions and time bucket, and each metric aggregated with its aggregation.
8. CalculateFormula metrics, weighted averages and custom fields are calculated from the aggregated values. Metric filters, order, limit and offset are applied.
9. ReturnThe result is cached (unless it’s empty) and returned with an annotation for each field.
  • Because sources are stacked, not joined, a query across platforms should use fields every platform has, usually unified fields. A dimension one source lacks is empty for that source’s rows.
  • Within one source, fields from different entities can only be combined where Jepto defines how the entities relate. Otherwise query each entity separately.
  • A query can read one BigQuery table. Query each table separately.
  • Steps 5 and 6 are why repeat queries are fast and why renewQuery: true is slower: it skips both caches for the query’s date range.

‍

Schema response

POST /schema (REST) and analyticsSchema (GraphQL) return the data model as { sources, metrics, dimensions }. Parameters are in REST API.

Response200 OK
{
  "sources": [
    {
      "dataSourceId": "a1b2c3d4e5f6g7h8",
      "type": "googleAds",
      "label": "Google Ads"
    },
    {
      "dataSourceId": "b1c2d3e4f5g6h7i8",
      "type": "googleAnalytics4",
      "label": "Google Analytics4"
    },
    { "type": "unified", "label": "Unified Schema" }
  ],
  "metrics": [
    {
      "name": "googleAds.spend",
      "label": "Cost (spend)",
      "kind": "metric",
      "type": "number",
      "format": { "type": "currency", "precision": 2 },
      "aggregation": "sum",
      "sourceGroup": "googleAds",
      "dataSources": ["googleAds"],
      "isCustomField": false,
      "dateGrain": "day"
    },
    {
      "name": "googleAds.ctr",
      "label": "CTR",
      "kind": "metric",
      "type": "number",
      "format": { "type": "percentage", "precision": 2 },
      "aggregation": "avg",
      "periodRollup": "formula",
      "formula": "googleAds.clicks / googleAds.impressions",
      "sourceGroup": "googleAds",
      "dataSources": ["googleAds"],
      "isCustomField": false
    }
  ],
  "dimensions": [
    {
      "name": "googleAds.campaignName",
      "label": "Campaign",
      "kind": "dimension",
      "type": "string",
      "sourceGroup": "googleAds",
      "dataSources": ["googleAds"],
      "isCustomField": false
    }
  ]
}

Source object

FieldTypeDescription
typestringSource key, such as googleAds, bigQuery or unified
labelstringDisplay name
dataSourceIdstring or absentThe connection ID, such as ds_a1b2c3d4e5f6a7b8 for a BigQuery table. Absent for unified; equal to type for aiVisibility.

Each source type appears once, except bigQuery, which appears once per connected table. Sources are sorted by label.

Field object

FieldTypeDescription
namestringThe field name to use in queries. Case-sensitive.
labelstringDisplay name shown in Jepto
kindstringmetric (goes in measures) or dimension (goes in dimensions and filters)
typestringValue type: number, string or boolean; BigQuery date and timestamp columns are time. Treat unknown values as strings.
formatobjectOptional. Display format: type (number, currency, percentage or decimal), precision (decimal places) and an optional suffix. Use it to show values the way Jepto does.
descriptionstringOptional. What the field measures.
aggregationstringMetrics only: sum, avg, min, max, count or count_distinct
periodRollupstringSome metrics: formula, weightedAverage or apiPeriod. See Period rollups.
formulastringWith periodRollup: formula. The calculation in field names, for example a CTR of clicks divided by impressions.
weightedBystringWith periodRollup: weightedAverage. The metric used as the weight.
dateGrainstringSome metrics. The finest granularity the metric can be bucketed by.
sourceGroupstringSource key the field belongs to
dataSourcesstring[]Sources the field reads. Unified and custom fields can list several.
isCustomFieldbooleantrue for custom fields
isDefaultDateFieldbooleanDate dimensions only. true for the field to use in timeDimensions.

Fields can be added at any time as sources or custom fields change, so read the schema rather than hard-coding the full list.