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

Granular Conversions for an Advertisable

You can use this query to replicate the Granular Conversion Report (GCR) that is generated in the dashboard. Note that this API does not support the converted user’s email. If you need an email address, you’ll have to use the GCR genreated by the dashboard.

{
  advertisable {
    byEID(advertisable: "MY_ADVERTISABLE_EID") {
      granularConversions(start: "2020-06-01", end: "2020-07-01") {
        time
        type
        attributionModel
        attributionCredit
        adrollConversionId
        touchpointTimestamp
        attributedConversions
        lastTouchAttribution
        channel
        campaignEID
        campaignType
        campaignName
        adgroupEID
        adgroupName
        adEID
        adName
        adSize
        segmentEID
        segmentName
        attributedRevenue
        externalData
        device
        country
        city
        firstTouchTimestamp
        lastTouchTimestamp
        daysToConversionFirstTouch
        daysToConversionLastTouch
        referrerURL
      }
    }
  }
}