GraphQL Reporting API Examples

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 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
        }
      }
    }
  }
}