none
Anyone Tried Pulling Data from AdWords API? RRS feed

  • Question

  • Hi guys,

    I am wondering if anyone has tried to pull data from AdWords API? Is it even possible?

    Specs: https://developers.google.com/adwords/api/docs/guides/start

    It uses OAuth2 authentication, I have seen some posts about LinkedIn data being pulled with the same authentication type.

    https://gallery.technet.microsoft.com/Excel-Power-Query-Linkedin-2776f40f

    Back to AdWords now, samplle code is here:

    POST /api/adwords/reportdownload/v201609 HTTP/1.1
    Host: adwords.google.com
    User-Agent: curl, gzip
    Accept: /
    Accept-Encoding: gzip
    Authorization: Bearer [Enter OAuth 2.0 access token here]
    developerToken: [Enter developerToken here]
    clientCustomerId: [Enter clientCustomerID here]
    Content-Length: 784
    Expect: 100-continue
    Content-Type: multipart/form-data; boundary=------------------------12d01fae60c7b559
     
    Parameters:
    __rdxml: <?xml version="1.0" encoding="UTF-8"?>
    <reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201609">
      <selector>
        <fields>CampaignId</fields>
        <fields>AdGroupId</fields>
        <fields>Impressions</fields>
        <fields>Clicks</fields>
        <fields>Cost</fields>
        <predicates>
          <field>AdGroupStatus</field>
          <operator>IN</operator>
          <values>ENABLED</values>
          <values>PAUSED</values>
        </predicates>
      </selector>
      <reportName>Custom Adgroup Performance Report</reportName>
      <reportType>ADGROUP_PERFORMANCE_REPORT</reportType>
      <dateRangeType>LAST_7_DAYS</dateRangeType>
      <downloadFormat>CSV</downloadFormat>
    </reportDefinition>

    Source: https://developers.google.com/adwords/api/docs/guides/reporting

    Something tells me it should be doable with PQ? Of course, I can get the necessary tokens, I am just not sure about syntax in PQ.

    DZ





    Sunday, February 12, 2017 8:53 AM

Answers

All replies

  • Here's an api query I setup to use map quest's api, maybe you can adapt some of it to your needs.

    let
        fnMapquestQuery = (Address) =>
    let
        Custom1 = (Web.Contents("http://open.mapquestapi.com/geocoding/v1/address",
    [Query=
    [#"key"="<<masked for privacy>>",
    #"thumbMaps"="false",
    #"location"=Text.From(Address)
    ]])),
        #"Imported JSON" = Json.Document(Custom1),
        results = #"Imported JSON"[results],
        results1 = results{0},
        locations = results1[locations],
        locations1 = locations{0},
        latLng = locations1[latLng],
        lat = latLng[lat],
        lng = latLng[lng],
        geocodeQuality = locations1[geocodeQuality],
        geocodeQualityCode = locations1[geocodeQualityCode],
        res = Text.From(lat) & "|" & Text.From(lng) & "|" & Text.From(geocodeQuality) & "|" & Text.From(geocodeQualityCode)
    in
        res
    in
        fnMapquestQuery

    As I recall, Map Quest's api returned the data in json or xml format.  It looks like adwords returns the data as a csv file to download, I'm not sure how much different that will be via Power Query.  

    If you don't have any luck with Power Query, you could checkout Google's Data Studio, it's free now and integrates with adwords. 

    Sunday, February 12, 2017 3:41 PM
  • Hi Daniel,

    Because the AdWords API uses OAuth2, it's unlikely you'll be able to do this unless we add it as a data source.

    Ehren

    Tuesday, February 14, 2017 11:21 PM
    Owner
  • Hi Ehren,

    okay, how about you guys add it as new data source? There would be like gazillion people from online advertising industry jumping on the PQ bandwagon.

    You can also add Bing Ads + Facebook Ads. :)

    DZ

    Wednesday, February 15, 2017 8:18 AM
  • Hi Daniel. If you'd like to see these data sources in the product, the best thing you can do is vote for them on ideas.powerbi.com (and encourange your fellow online advertising folks to do the same).

    Ehren

    Wednesday, February 15, 2017 5:58 PM
    Owner