GraphQL Reporting API Examples

Warning

The GraphQL Reporting is in beta and the schema may change. Currently only campaign-level data is stable, all other data may be unstable. We’re planning a mid-Q1 2018 launch. If you have questions or feedback, please contact the API team.

The examples on this page contain GraphQL queries. For how to run these queries, see Your First Query.

List of Advertisables for your Organization

{
  organization {
    current {
      advertisables {
        eid
        name
      }
    }
  }
}

List of Campaigns for an Advertisable

{
  advertisable {
    byEID(advertisable: "MY_ADVERTISABLE_EID") {
      eid
      name
      campaigns {
        eid
        name
      }
    }
  }
}

Delivery and Attribution data for all Campaigns

{
  advertisable {
    byEID(advertisable: "MY_ADVERTISABLE_EID") {
      eid
      name
      campaigns {
        eid
        name
        channel
        metrics(start: "2017-06-01", end: "2017-06-02", currency: "USD") {
          byDate {
            # Deliveries
            impressions
            clicks
            cost

            # Attribution
            viewThroughs
            clickThroughs
            viewRevenue
            clickRevenue
          }
        }
      }
    }
  }
}

Delivery and Attribution data for a Campaign

{
  campaign {
    byEID(campaign: "MY_CAMPAIGN_EID") {
      eid
      name
      metrics(start: "2017-06-01", end: "2017-06-02", currency: "USD") {
        byDate {
          impressions
          clicks
          cost
          viewThroughs
          clickThroughs
          viewRevenue
          clickRevenue
        }
      }
    }
  }
}

Delivery and Attribution data for an AdGroup

{
  adgroup {
    byEID(adgroup: "MY_ADGROUP_EID") {
      eid
      name
      status
      metrics(start: "2017-06-01", end: "2017-06-02", currency: "USD") {
        byDate {
          # Deliveries
          impressions
          clicks
          cost

          # Attribution
          viewThroughs
          clickThroughs
          viewRevenue
          clickRevenue
        }
      }
    }
  }
}

Delivery and Attribution data for a Segment

{
  segment {
    byEID(segment: "MY_SEGMENT_EID") {
      eid
      name
      type
      metrics(start: "2017-06-01", end: "2017-06-02", currency: "USD") {
        byDate {
          # Deliveries
          impressions
          clicks
          cost

          # Attribution
          viewThroughs
          clickThroughs
          viewRevenue
          clickRevenue
        }
      }
    }
  }
}

Delivery and Attribution data for an Ad

{
  ad {
    byEID(ad: "MY_AD_EID") {
      eid
      name
      adFormatName
      metrics(start: "2017-06-01", end: "2017-06-02", currency: "USD") {
        byDate {
          impressions
          clicks
          cost
          viewThroughs
          clickThroughs
          viewRevenue
          clickRevenue
        }
      }
    }
  }
}