Migrate from the Reporting API¶
The GraphQL Reporting API is the best way to easily fetch all the metrics for your accounts. If you’re still using the Reporting API, you can use this guide to upgrade your integration.
Benefits:
Fetch delivery and attribution data in a single call
Get details about the objects you’re reporting on such, as the name or campaign types
Retrieve metrics for nested objects
If you’re unfamiliar with the GraphQL Reporting API, you should check out the introduction first.
Helpful tips¶
The sample queries make use of two GraphQL features that may be new to you:
GraphQL fragments are used to reduce duplicate code in queries
GraphQL variables are used to parameterize EIDs and dates in queries for easy reuse
When querying objects, you can query the object by EID or through its parent object (i.e., fetch all Campaigns in an Advertisable)
The following are the vital GraphQL types in our schema that contain reporting data. They can be accessed through a variety of queries.
GraphQL makes it easy to query for a lot of data in a single request. However, be mindful of how many subject objects you’re querying and how many days of data you’re fetching. We recommend you paginate your requests using GraphQL variables for the list of EIDs and date ranges you’re retrieving.
You can experiment with building queries using GraphiQL.
Replacement GraphQL queries¶
To help you migrate your application, the following tables give you a sample replacement query for each Reporting API endpoint. You can find additional examples in GraphQL Reporting API Examples.
Category |
Endpoint |
Example GraphQL queries |
---|---|---|
Attribution |
|
|
Attribution |
|
|
Attribution |
|
|
Attribution |
|
|
Attribution |
|
|
Attribution |
|
|
Attribution |
|
|
Attribution |
|
|
Deliveries |
|
|
Deliveries |
|
|
Deliveries |
|
|
Deliveries |
|
|
Deliveries |
|
|
Deliveries |
|
The following Reporting API endpoints don’t have a direct replacement, but in the notes column you’ll find suggested workarounds.
Category |
Endpoint |
Notes |
---|---|---|
Attribution |
|
Instead of retrieving by segment, fetch attribution metrics by AdGroup, Campaign, or Advertisable |
Attribution, Deliveries |
|
No replacement available, this metric only applies to campaigns targeting CRM audiences on the Web |
Attribute |
|
See the create attribute audiences guide |
Attribute |
|
See the create attribute audiences guide |
Deliveries |
|
Fetch delivery metrics by Advertisable |
Deliveries |
|
Fetch delivery metrics by AdGroup, Campaign, or Advertisable |
Deliveries |
|
Fetch delivery metrics by AdGroup, Campaign, or Advertisable |
Deliveries |
|
Fetch delivery metrics by AdGroup, Campaign, or Advertisable |
Deliveries |
|
RollWorks customers can fetch delivery metrics by Account for campaign |
Deliveries |
|
RollWorks customers can fetch delivery metrics by Account for campaign |
Deliveries |
|
RollWorks customers can fetch delivery metrics by Account for campaign |
Index of sample queries by object types
Metrics by Advertisable¶
Replaces
/uhura/v1/attributions/advertisable
/uhura/v1/attributions/export
/uhura/v1/deliveries/advertisable
/uhura/v1/deliveries/export
query AdvertisableMetricsQuery($advertisables: [String], $startDate: Date, $endDate: Date) {
advertisable {
byEIDs(eids: $advertisables) {
eid
name
metrics(start: $startDate, end: $endDate) {
summary {
...performanceMetrics
...conversionMetrics
}
byDate {
date
...performanceMetrics
...conversionMetrics
}
}
}
}
}
fragment performanceMetrics on MetricForAdvertisable {
cost
impressions
clicks
ctr
cpm
cpc
}
fragment conversionMetrics on MetricForAdvertisable {
conversions
cpa
clickThroughs
clickCPA
viewThroughs
viewCPA
}
Metrics by Campaign¶
Replaces
/uhura/v1/attributions/campaign
/uhura/v1/attributions/export
/uhura/v1/deliveries/campaign
/uhura/v1/deliveries/export
query CampaignMetricsQuery($campaigns: [String], $startDate: Date, $endDate: Date) {
campaign {
byEIDs(eids: $campaigns) {
eid
name
metrics(start: $startDate, end: $endDate) {
summary {
...performanceMetricsSummary
...conversionMetricsSummary
}
byDate {
date
...performanceMetrics
...conversionMetrics
}
}
}
}
}
fragment performanceMetricsSummary on Metric {
cost
impressions
clicks
ctr
cpm
cpc
}
fragment conversionMetricsSummary on Metric {
conversions
cpa
clickThroughs
clickCPA
viewThroughs
viewCPA
}
fragment performanceMetrics on MetricForCampaign {
cost
impressions
clicks
ctr
cpm
cpc
}
fragment conversionMetrics on MetricForCampaign {
conversions
cpa
clickThroughs
clickCPA
viewThroughs
viewCPA
}
Metrics by AdGroup¶
Replaces
/uhura/v1/attributions/adgroup
/uhura/v1/attributions/export
/uhura/v1/deliveries/adgroup
/uhura/v1/deliveries/export
query AdGroupMetricsQuery($adgroups: [String], $startDate: Date, $endDate: Date) {
adgroup {
byEIDs(eids: $adgroups) {
eid
name
metrics(start: $startDate, end: $endDate) {
summary {
...performanceMetrics
...conversionMetrics
}
byDate {
date
...performanceMetrics
...conversionMetrics
}
}
}
}
}
fragment performanceMetrics on Metric {
cost
impressions
clicks
ctr
cpm
cpc
}
fragment conversionMetrics on Metric {
conversions
cpa
clickThroughs
clickCPA
viewThroughs
viewCPA
}
Metrics by Ad¶
Replaces
/uhura/v1/attributions/ad
/uhura/v1/attributions/export
/uhura/v1/deliveries/ad
/uhura/v1/deliveries/export
query AdMetricsQuery($ads: [String], $startDate: Date, $endDate: Date) {
ad {
byEIDs(eids: $ads) {
eid
name
metrics(start: $startDate, end: $endDate) {
summary {
...performanceMetrics
...conversionMetrics
}
byDate {
date
...performanceMetrics
...conversionMetrics
}
}
}
}
}
fragment performanceMetrics on Metric {
cost
impressions
clicks
ctr
cpm
cpc
}
fragment conversionMetrics on Metric {
conversions
cpa
clickThroughs
clickCPA
viewThroughs
viewCPA
}
Metrics by Facebook Placement¶
Replaces
/uhura/v1/attributions/wca-placement
/uhura/v1/deliveries/wca-placement
/uhura/v1/attributions/wca-placement/export
query FacebookPlacementMetricsQuery($adgroups: [String], $startDate: Date, $endDate: Date) {
adgroup {
byEIDs(eids: $adgroups) {
eid
name
placements(start: $startDate, end: $endDate) {
byPlacement {
placement
...performanceMetrics
...conversionMetrics
}
}
}
}
}
fragment performanceMetrics on Placement {
cost
impressions
clicks
ctr
cpm
cpc
}
fragment conversionMetrics on Placement {
conversions
cpa
clickThroughs
clickCPA
viewThroughs
viewCPA
}
Metrics by Delivery Account¶
Replaces
/uhura/v1/deliveries/domain
/uhura/v1/deliveries/domain/ad
/uhura/v1/deliveries/domain/adgroup
RollWorks customers can query for delivery metrics for Accounts targeted by their campaigns.
query AccountMetrics($advertisable: String, $campaigns: [String], $startDate: Date, $endDate: Date) {
accountMetrics {
summary(advertisableEID: $advertisable, campaignEIDs: $campaigns, start: $startDate, end: $endDate) {
domain
cost
impressions
clicks
adjustedClickThroughs
adjustedViewThroughs
}
}
}
Granular Conversions¶
Replaces
/uhura/v1/combined-granular-attributions
query GranularConversionsQuery($advertisables: [String], $startDate: Date, $endDate: Date) {
advertisable {
byEIDs(eids: $advertisables) {
granularConversions(start: $startDate, end: $endDate) {
time
type
attributionCredit
adrollConversionId
touchpointTimestamp
attributedConversions
lastTouchAttribution
channel
campaignEID
campaignType
campaignName
adgroupEID
adgroupName
adEID
adName
adSize
segmentEID
segmentName
attributedRevenue
externalData
device
campaignEID
}
}
}
}