title: Facebook ads insights API - get basic metrics
body: <p>I would like to connect to the Facebook Ads Insights API with google scripts  in order to generate and update a google sheet containing my ads key performance indicators.</p>
  
  <p>I have read Facebook's documentation but I'm a bit lost, for example In the documentation's website, I can see that I am supposed to follow this syntax to get a campaign's impressions</p>
  
  <pre><code>GET &lt;AD_OBJECT&gt;/insights?fields=impressions
  </code></pre>
  
  <p>but I'm not quite sure where that would fit in a cURL get query, should it look like this ?</p>
  
  <pre><code>https://graph.facebook.com/v2.5/CAMPAIN_ID/insights?fields=impressions%?access_token=TOKEN
  </code></pre>
  
  <p>I have tried to build the following google script but I'm not sure it's getting anywhere, any help ?</p>
  
  <pre><code>    var myClientID = '';
  var myClientSecret = '';
  var myAccessToken = 'MY_TOKEN';
  var graphURL = 'https://graph.facebook.com/v2.5/';
  
  function getPageLikes(campaign_id) {
    var searchParams = '?fields=impressions%2Cunique_clicks%2Creach';
    var campaignID = MY_CAMPAIGN_ID;
    var fullURL = graphURL + campaignID + '/insights/' + searchParams + '&amp;access_token=' + myAccessToken;
    var fetchResult = UrlFetchApp.fetch(fullURL);
    var campaign = JSON.parse(fetchResult);
    var likes = campaign.data[0];
    return campaign_data;
  
  }
  </code></pre>
  
  <p>Thank you</p>